Image decoding method and apparatus based on motion prediction in sub-block unit in image coding system

ABSTRACT

An image decoding method according to the present document includes obtaining motion prediction information for a current block from a bitstream, generating an affine MVP candidate list for the current block, deriving CPMVPs for CPs of the current block based on the affine MVP candidate list, deriving CPMVDs for the CPs of the current block based on the motion prediction information, deriving CPMVs for the CPs of the current block based on the CPMVPs and the CPMVDs, and deriving prediction samples for the current block based on the CPMVs.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of Ser. No. 17/124,231, filed Dec.16, 2020, which is a continuation of U.S. patent application Ser. No.16/836,248, filed on Mar. 31, 2020, issued as U.S. Pat. No. 10,904,561,which is a continuation of International Application No.PCT/KR2019/011827, filed on Sep. 11, 2019, which claims the benefit ofU.S. Provisional Application No. 62/730,528, filed on Sep. 12, 2018, thecontents of which are hereby incorporated by reference herein in theirentirety.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present document relates to an image coding technique, and moreparticularly, to an image decoding method and apparatus based on motionprediction using a motion candidate list for deriving motion informationof a subblock unit in an image coding system.

Related Art

Nowadays, the demand for high-resolution and high-quality images/videossuch as 4K, 8K or more ultra high definition (UHD) images/videos hasbeen increasing in various fields. As the image/video data becomeshigher resolution and higher quality, the transmitted information amountor bit amount increases as compared to the conventional image data.Therefore, when image data is transmitted using a medium such as aconventional wired/wireless broadband line or image/video data is storedusing an existing storage medium, the transmission cost and the storagecost thereof are increased.

Further, nowadays, the interest and demand for immersive media such asvirtual reality (VR), and artificial reality (AR) contents or holograms,or the like is increasing, and broadcasting for images/videos havingimage features different from a real image, such as a game image, isincreasing.

Accordingly, there is a need for a highly efficient image/videocompression technique for effectively compressing and transmitting orstoring, and reproducing information of high resolution and high qualityimages/videos having various features as described above.

SUMMARY

A technical problem to be addressed in the present document lies inproviding a method and an apparatus which increase image codingefficiency.

Another technical problem to be addressed in the present document liesin providing an image decoding method and apparatus which configure anaffine MVP candidate list of the current block by deriving a constructedaffine MVP candidate based on a neighboring block only when allcandidate motion vectors for CPs are available, and perform predictionfor the current block based on the configured affine MVP candidate list.

Another technical problem to be addressed in the present document liesin providing an image decoding method and apparatus which derive anaffine MVP candidate using a candidate motion vector that has beenderived in a process of deriving the constructed affine MVP candidate,as an added affine MVP candidate when the number of available inheritedaffine MVP candidates and constructed affine MVP candidates is less thanthe maximum number of candidates of a MVP candidate list, and whichperform prediction for the current block based on the configured affineMVP candidate list.

According to an example of the present document, there is provided animage decoding method, by a decoding apparatus, comprising: obtainingmotion prediction information for a current block from a bitstream;configuring an affine motion vector predictor (MVP) candidate list forthe current block; deriving control point motion vector predictors(CPMVPs) for control points (CPs) of the current block based on theaffine MVP candidate list; deriving control point motion vectordifferences (CPMVDs) for CPs of the current block based on the motionprediction information; deriving control point motion vectors (CPMVs)for CPs of the current block based on the CPMVPs and CPMVDs; derivingprediction samples for the current block based on the CPMVs; andgenerating a reconstructed picture for the current block based on thederived prediction samples, wherein the configuring of the affine MVPcandidate list comprises: checking whether a first affine MVP candidateis available, wherein the first affine MVP candidate is available when afirst block in a left block group is coded with an affine motion modeland a reference picture index of the first block is same as a referencepicture index of the current block; checking whether a second affine MVPcandidate is available, wherein the second affine MVP candidate isavailable when a second block in a top block group is coded with anaffine motion model and a reference picture index of the second block issame as a reference picture index of the current block; when a number ofthe available affine MVP candidate is less than 2, checking whether athird affine MVP candidate available, wherein the third MVP affinecandidate is available when a first motion vector for CP0 of the currentblock and a second motion vector for CP1 of the current block arederived from a top-left block group of the current block and a top-rightblock group of the current block respectively for a 4-parameter affinemodel being applied to inter prediction, and wherein the third MVPaffine candidate is available when a first motion vector for CP0 of thecurrent block, a second motion vector for CP1 of the current block and athird motion vector for CP2 of the current block are derived from atop-left block group of the current block, a top-right block group ofthe current block, and the left block group respectively for a6-parameter affine model being applied to inter prediction; when thenumber of available affine MVP candidates is less than 2 and the firstmotion vector is available, deriving a fourth affine MVP candidate,wherein the fourth affine MVP candidate includes a motion vector for theCP0 as candidate motion vectors for the CPs; when the number ofavailable affine MVP candidates is less than 2 and the second motionvector is available, deriving a fifth affine MVP candidate, wherein thefifth affine MVP candidate includes a motion vector for the CP1 ascandidate motion vectors for the CPs; when the number of availableaffine MVP candidates is less than 2 and a third motion vector for CP2of the current block is available, deriving a sixth affine MVPcandidate, wherein the sixth affine MVP candidate includes the thirdmotion vector as candidate motion vectors for the CPs; when the numberof available affine MVP candidates is less than 2 and a temporal MVPcandidate derived based on a temporal neighboring block of the currentblock is available, deriving a seventh affine MVP candidate includingthe temporal MVP as candidate motion vectors for the CPs; and when thenumber of available affine MVP candidates is less than 2, derives aneighth affine MVP candidate including a zero motion vector as candidatemotion vectors for the CPs.

According to an example of the present document, there is provided animage encoding method, by an encoding apparatus, comprising: configuringan affine motion vector predictor (MVP) candidate list for a currentblock; deriving control point motion vector predictors (CPMVPs) forcontrol points (CPs) of the current block based on the affine MVPcandidate list; deriving CPMVs for the CPs of the current block;deriving control point motion vector differences (CPMVDs) for the CPs ofthe current block based on the CPMVPs and CPMVs; and encoding motionprediction information including information on the CPMVDs, wherein theconfiguring of the affine MVP candidate list comprises: checking whethera first affine MVP candidate is available, wherein the first affine MVPcandidate is available when a first block in a left block group is codedwith an affine motion model and a reference picture index of the firstblock is same as a reference picture index of the current block;checking whether a second affine MVP candidate is available, wherein thesecond affine MVP candidate is available when a second block in a topblock group is coded with an affine motion model and a reference pictureindex of the second block is same as a reference picture index of thecurrent block; when a number of the available affine MVP candidate isless than 2, checking whether a third affine MVP candidate available,wherein the third MVP affine candidate is available when a first motionvector for CP0 of the current block and a second motion vector for CP1of the current block are derived from a top-left block group of thecurrent block and a top-right block group of the current blockrespectively for a 4-parameter affine model being applied to interprediction, and wherein the third MVP affine candidate is available whena first motion vector for CP0 of the current block, a second motionvector for CP1 of the current block and a third motion vector for CP2 ofthe current block are derived from a top-left block group of the currentblock, a top-right block group of the current block, and the left blockgroup respectively for a 6-parameter affine model being applied to interprediction; when the number of available affine MVP candidates is lessthan 2 and the first motion vector is available, deriving a fourthaffine MVP candidate, wherein the fourth affine MVP candidate includes amotion vector for the CP0 as candidate motion vectors for the CPs; whenthe number of available affine MVP candidates is less than 2 and thesecond motion vector is available, deriving a fifth affine MVPcandidate, wherein the fifth affine MVP candidate includes a motionvector for the CP1 as candidate motion vectors for the CPs; when thenumber of available affine MVP candidates is less than 2 and a thirdmotion vector for CP2 of the current block is available, deriving asixth affine MVP candidate, wherein the sixth affine MVP candidateincludes the third motion vector as candidate motion vectors for theCPs; when the number of available affine MVP candidates is less than 2and a temporal MVP candidate derived based on a temporal neighboringblock of the current block is available, deriving a seventh affine MVPcandidate including the temporal MVP as candidate motion vectors for theCPs; and when the number of available affine MVP candidates is less than2, derives an eighth affine MVP candidate including a zero motion vectoras candidate motion vectors for the CPs.

According to an example of the present document, it is possible toincrease general image/video compression efficiency.

According to the present document, it is possible to increase theefficiency of image coding based on the affine motion prediction.

According to the present document, in deriving the affine MVP candidatelist, only when all the candidate motion vectors for the CPs of theconstructed affine MVP candidate are available, the constructed affineMVP candidate may be added, through which it is possible to reduce thecomplexity of the process of deriving the constructed affine MVPcandidate and the process of configuring the affine MVP candidate list,and to improve the coding efficiency.

According to the present document, in deriving the affine MVP candidatelist, the additional affine MVP candidate may be derived based on thecandidate motion vector for the CP derived in the process of derivingthe constructed affine MVP candidate, through which it is possible toreduce the complexity of the process of configuring the affine MVPcandidate list, and to improve the coding efficiency.

According to the present document, in the process of deriving theinherited affine MVP candidate, only when the top neighboring block isincluded in the current CTU, the inherited affine MVP candidate may bederived using the top neighboring block, through which it is possible toreduce the storing amount of the line buffer for affine prediction, andto minimize hardware costs.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically represents an example of a video/image codingsystem to which the present document may be applied.

FIG. 2 is a diagram schematically describing a configuration of avideo/image encoding apparatus to which the present document may beapplied.

FIG. 3 is a diagram schematically describing a configuration of avideo/image decoding apparatus to which the present document may beapplied.

FIG. 4 represents an example of an inter prediction based video/imageencoding method.

FIG. 5 represents an example of an inter prediction based video/imageencoding method.

FIG. 6 illustratively represents an inter prediction procedure.

FIG. 7 illustratively represents motions which are expressed through anaffine motion model.

FIG. 8 illustratively represents the affine motion model in which motionvectors for three control points are used.

FIG. 9 illustratively represents a motion model of the affine unit inwhich motion vectors for two control points are used.

FIG. 10 illustratively represents a method of deriving a motion vectorin a subblock unit based on the affine motion model.

FIG. 11 illustratively represents neighboring blocks for deriving theinherited affine candidate.

FIG. 12 illustratively represents a spatial candidate for theconstructed affine candidate.

FIG. 13 illustratively represents an example of configuring an affineMVP list.

FIG. 14 represents an example of deriving the constructed candidate.

FIG. 15 represents an example of deriving the constructed candidate.

FIG. 16 illustratively represents a neighboring block position which isscanned to derive the inherited affine candidate.

FIG. 17 illustratively represents a neighboring block position which isscanned to derive the inherited affine candidate.

FIG. 18 illustratively represents a position for deriving the inheritedaffine candidate.

FIG. 19 represents an example of configuring the merge candidate list ofthe current block.

FIG. 20 represents neighboring blocks of the current block for derivinga constructed candidate according to an example of the present document.

FIG. 21 represents an example of deriving the constructed candidate fora 4-affine motion model being applied to the current block.

FIG. 22 represents an example of deriving the constructed candidate fora 6-affine motion model being applied to the current block.

FIGS. 23 a and 23 b illustratively represent an example of deriving theinherited affine candidate.

FIG. 24 schematically represents an image encoding method by an encodingapparatus according to the present document.

FIG. 25 schematically represents an encoding apparatus performing animage encoding method according to the present document.

FIG. 26 schematically represents an image decoding method by a decodingapparatus according to the present document.

FIG. 27 schematically represents a decoding apparatus performing animage decoding method according to the document.

FIG. 28 illustratively represents a contents streaming system structurediagram to which the embodiments disclosed in the present document maybe applied.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

While the present document may be susceptible to various modificationsand include various embodiments, specific embodiments thereof have beenshown in the drawings by way of example and will now be described indetail. However, this is not intended to limit the present document tothe specific embodiments disclosed herein. The terminology used hereinis for the purpose of describing specific embodiments only, and is notintended to limit technical idea of the present document. The singularforms may include the plural forms unless the context clearly indicatesotherwise. The terms such as “include” and “have” are intended toindicate that features, numbers, steps, operations, elements,components, or combinations thereof used in the following descriptionexist, and thus should not be understood as that the possibility ofexistence or addition of one or more different features, numbers, steps,operations, elements, components, or combinations thereof is excluded inadvance.

Meanwhile, each component on the drawings described herein isillustrated independently for convenience of description as tocharacteristic functions different from each other, and however, it isnot meant that each component is realized by a separate hardware orsoftware. For example, any two or more of these components may becombined to form a single component, and any single component may bedivided into plural components. The embodiments in which components arecombined and/or divided will belong to the scope of the patent right ofthe present document as long as they do not depart from the essence ofthe present document.

Hereinafter, preferred embodiments of the present document will beexplained in more detail while referring to the attached drawings. Inaddition, the same reference signs are used for the same components onthe drawings, and repeated descriptions for the same components will beomitted.

FIG. 1 schematically represents an example of a video/image codingsystem to which the present document may be applied.

Referring to FIG. 1 , the video/image coding system may include a firstdevice (source device) and a second device (receive device). The sourcedevice may deliver encoded video/image information or data in the formof a file or streaming to the receive device via a digital storagemedium or network.

The source device may include a video source, an encoding apparatus, anda transmitter. The receive device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may obtain a video/image through a process ofcapturing, synthesizing, or generating a video/image. The video sourcemay include a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, or the like. The video/image generating device mayinclude, for example, a computer, a tablet and a smartphone, and may(electronically) generate a video/image. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode an input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compression and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded video/image information or dataoutput in the form of a bitstream to the receiver of the receive devicethrough a digital storage medium or a network in the form of a file orstreaming. The digital storage medium may include various storagemediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and the like. Thetransmitter may include an element for generating a media file through apredetermined file format, and may include an element for transmissionthrough a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received/extractedbitstream to the decoding apparatus.

The decoding apparatus may decode a video/image by performing a seriesof procedures such as dequantization, inverse transform, prediction, andthe like corresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

This document relates to video/image coding. For example, amethod/embodiment disclosed in this document may be applied to methodsdisclosed in versatile video coding (VVC) standard, essential videocoding (EVC) standard, AOMedia Video 1 (AV1) standard, 2nd generation ofaudio video coding standard (AVS2) or next generation video/image codingstandard (e.g., H.267, H.268, or the like).

In this document, a variety of embodiments relating to video/imagecoding may be provided, and, unless specified to the contrary, theembodiments may be combined to each other and be performed.

In this document, a video may mean a set of a series of images overtime. Generally a picture means a unit representing an image at aspecific time zone, and a slice/tile is a unit constituting a part ofthe picture. The slice/tile may include one or more coding tree units(CTUs). One picture may be constituted by one or more slices/tiles. Onepicture may be constituted by one or more tile groups. One tile groupmay include one or more tiles. A brick may represent a rectangularregion of CTU rows within a tile in a picture. A tile may be partitionedinto a multiple bricks, each of which consisting of one or more CTU rowswithin the tile. A tile that is not partitioned into multiple bricks maybe also referred to as a brick. A brick scan may be a specificsequential ordering of CTUs partitioning a picture in which the CTUs maybe ordered in CTU raster scan in a brick, bricks within a tile may beordered consecutively in a raster scan of the bricks of the tile, andtiles in a picture may be ordered consecutively in a raster scan of thetiles of the picture (A brick scan is a specific sequential ordering ofCTUs partitioning a picture in which the CTUs are ordered consecutivelyin CTU raster scan in a brick, bricks within a tile are orderedconsecutively in a raster scan of the bricks of the tile, and tiles in apicture are ordered consecutively in a raster scan of the tiles of thepicture). A tile is a rectangular region of CTUs within a particulartile column and a particular tile column (A tile is a rectangular regionof CTUs within a particular tile column and a particular tile row in apicture). The tile column is a rectangular region of CTUs having aheight equal to the height of the picture and a width specified bysyntax elements in the picture parameter set. The tile row is arectangular region of CTUs having a width specified by syntax elementsin the picture parameter set and a height equal to the height of thepicture (The tile row is a rectangular region of CTUs having a heightspecified by syntax elements in the picture parameter set and a widthequal to the width of the picture). A tile scan may be a specificsequential ordering of CTUs partitioning a picture in which the CTUs maybe ordered consecutively in CTU raster scan in a tile whereas tiles in apicture may be ordered consecutively in a raster scan of the tiles ofthe picture (A tile scan is a specific sequential ordering of CTUspartitioning a picture in which the CTUs are ordered consecutively inCTU raster scan in a tile whereas tiles in a picture are orderedconsecutively in a raster scan of the tiles of the picture). A slice mayinclude an integer number of bricks of a picture that may be containedin a single NAL unit (A slice includes an integer number of bricks of apicture that may be exclusively contained in a single NAL unit). A slicemay consist of either a number of complete tiles or only a consecutivesequence of complete bricks of one tile. In this document, a tile groupand a slice may be used in place of each other. For example, in thisdocument, a tile group/tile group header may be referred to as aslice/slice header.

A pixel or a pel may mean a minimum unit constituting one picture (orimage). Further, a “sample” may be used as a term corresponding to apixel. A sample may generally represent a pixel or a value of a pixel,and may represent only a pixel/pixel value of a luma component, or onlya pixel/pixel value of a chroma component.

A unit may represent the basic unit of image processing. The unit mayinclude at least one of a specific region and information related to theregion. One unit may include one luma block and two chroma (e.g., cb,cr) blocks. The unit and a term such as a block, an area, or the likemay be used in place of each other according to circumstances. In ageneral case, an M×N block may include a set (or an array) of samples(or sample arrays) or transform coefficients consisting of M columns andN rows.

In this document, the term “/” and “,” should be interpreted to indicate“and/or.” For instance, the expression “A/B” may mean “A and/or B.”Further, “A, B” may mean “A and/or B.” Further, “A/B/C” may mean “atleast one of A, B, and/or C.” Also, “A, B, C” may mean “at least one ofA, B, and/or C.” (In this document, the term “/” and “,” should beinterpreted to indicate “and/or.” For instance, the expression “A/B” maymean “A and/or B.” Further, “A, B” may mean “A and/or B.” Further,“A/B/C” may mean “at least one of A, B, and/or C.” Also, “A/B/C” maymean “at least one of A, B, and/or C.”)

Further, in the document, the term “or” should be interpreted toindicate “and/or.” For instance, the expression “A or B” may comprise 1)only “A”, 2) only “B”, and/or 3) both “A and B”. In other words, theterm “or” in this document should be interpreted to indicate“additionally or alternatively.” (Further, in the document, the term“or” should be interpreted to indicate “and/or.” For instance, theexpression “A or B” may comprise 1) only A, 2) only B, and/or 3) both Aand B. In other words, the term “or” in this document should beinterpreted to indicate “additionally or alternatively.”)

FIG. 2 is a diagram schematically describing a configuration of avideo/image encoding apparatus to which the present document may beapplied. Hereinafter, what is referred to as the video encodingapparatus may include an image encoding apparatus.

Referring to FIG. 2 , the encoding apparatus 200 may include an imagepartitioner 210, a predictor 220, a residual processor 230, an entropyencoder 240, an adder 250, a filter 260, and a memory 270. The predictor220 may include an inter predictor 221 and an intra predictor 222. Theresidual processor 230 may include a transformer 232, a quantizer 233, adequantizer 234, an inverse transformer 235. The residual processor 230may further include a subtractor 231. The adder 250 may be called areconstructor or reconstructed block generator. The image partitioner210, the predictor 220, the residual processor 230, the entropy encoder240, the adder 250, and the filter 260, which have been described above,may be constituted by one or more hardware components (e.g., encoderchipsets or processors) according to an embodiment. Further, the memory270 may include a decoded picture buffer (DPB), and may be constitutedby a digital storage medium. The hardware component may further includethe memory 270 as an internal/external component.

The image partitioner 210 may partition an input image (or a picture ora frame) input to the encoding apparatus 200 into one or more processingunits. As one example, the processing unit may be called a coding unit(CU). In this case, starting with a coding tree unit (CTU) or thelargest coding unit (LCU), the coding unit may be recursivelypartitioned according to the Quad-tree binary-tree ternary-tree (QTBTTT)structure. For example, one coding unit may be divided into a pluralityof coding units of a deeper depth based on the quad-tree structure, thebinary-tree structure, and/or the ternary structure. In this case, forexample, the quad-tree structure may be applied first and thebinary-tree structure and/or the ternary structure may be applied later.Alternatively, the binary-tree structure may be applied first. Thecoding procedure according to the present document may be performedbased on the final coding unit which is not further partitioned. In thiscase, the maximum coding unit may be used directly as a final codingunit based on coding efficiency according to the image characteristic.Alternatively, the coding unit may be recursively partitioned intocoding units of a further deeper depth as needed, so that the codingunit of an optimal size may be used as a final coding unit. Here, thecoding procedure may include procedures such as prediction, transform,and reconstruction, which will be described later. As another example,the processing unit may further include a prediction unit (PU) or atransform unit (TU). In this case, the prediction unit and the transformunit may be split or partitioned from the above-described final codingunit. The prediction unit may be a unit of sample prediction, and thetransform unit may be a unit for deriving a transform coefficient and/ora unit for deriving a residual signal from a transform coefficient.

The unit and a term such as a block, an area, or the like may be used inplace of each other according to circumstances. In a general case, anM×N block may represent a set of samples or transform coefficientsconsisting of M columns and N rows. The sample may generally represent apixel or a value of a pixel, and may represent only a pixel/pixel valueof a luma component, or only a pixel/pixel value of a chroma component.The sample may be used as a term corresponding to a pixel or a pel ofone picture (or image).

In the encoding apparatus 200, a prediction signal (predicted block,prediction sample array) output from the inter predictor 221 or theintra predictor 222 is subtracted from an input image signal (originalblock, original sample array) to generate a residual signal (residualblock, residual sample array), and the generated residual signal istransmitted to the transformer 232. In this case, as shown, a unit whichsubtracts the prediction signal (predicted block, prediction samplearray) from the input image signal (original block, original samplearray) in the encoder 200 may be called the subtractor 231. Thepredictor may perform prediction on a processing target block(hereinafter, referred to as ‘current block’), and may generate apredicted block including prediction samples for the current block. Thepredictor may determine whether intra prediction or inter prediction isapplied on a current block or CU basis. As discussed later in thedescription of each prediction mode, the predictor may generate variousinformation relating to prediction, such as prediction mode information,and transmit the generated information to the entropy encoder 240. Theinformation on the prediction may be encoded in the entropy encoder 240and output in the form of a bitstream.

The intra predictor 222 may predict the current block by referring tosamples in the current picture. The referred samples may be located inthe neighbor of or apart from the current block according to theprediction mode. In the intra prediction, prediction modes may include aplurality of non-directional modes and a plurality of directional modes.The non-directional modes may include, for example, a DC mode and aplanar mode. The directional mode may include, for example, 33directional prediction modes or 65 directional prediction modesaccording to the degree of detail of the prediction direction. However,this is merely an example, and more or less directional prediction modesmay be used depending on a setting. The intra predictor 222 maydetermine the prediction mode applied to the current block by using theprediction mode applied to the neighboring block.

The inter predictor 221 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to reducethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted on a block, subblock, orsample basis based on correlation of motion information between theneighboring block and the current block. The motion information mayinclude a motion vector and a reference picture index. The motioninformation may further include inter prediction direction (L0prediction, L1 prediction, Bi prediction, etc.) information. In the caseof inter prediction, the neighboring block may include a spatialneighboring block existing in the current picture and a temporalneighboring block existing in the reference picture. The referencepicture including the reference block and the reference pictureincluding the temporal neighboring block may be same to each other ordifferent from each other. The temporal neighboring block may be calleda collocated reference block, a collocated CU (colCU), and the like, andthe reference picture including the temporal neighboring block may becalled a collocated picture (colPic). For example, the inter predictor221 may configure a motion information candidate list based onneighboring blocks and generate information indicating which candidateis used to derive a motion vector and/or a reference picture index ofthe current block. Inter prediction may be performed based on variousprediction modes. For example, in the case of a skip mode and a mergemode, the inter predictor 221 may use motion information of theneighboring block as motion information of the current block. In theskip mode, unlike the merge mode, the residual signal may not betransmitted. In the case of the motion information prediction (motionvector prediction, MVP) mode, the motion vector of the neighboring blockmay be used as a motion vector predictor and the motion vector of thecurrent block may be indicated by signaling a motion vector difference.

The predictor 220 may generate a prediction signal based on variousprediction methods. For example, the predictor may apply intraprediction or inter prediction for prediction on one block, and, aswell, may apply intra prediction and inter prediction at the same time.This may be called combined inter and intra prediction (CIIP). Further,the predictor may be based on an intra block copy (IBC) prediction mode,or a palette mode in order to perform prediction on a block. The IBCprediction mode or palette mode may be used for content image/videocoding of a game or the like, such as screen content coding (SCC).Although the IBC basically performs prediction in a current block, itcan be performed similarly to inter prediction in that it derives areference block in a current block. That is, the IBC may use at leastone of inter prediction techniques described in the present document.The palette mode may be regarded as an example of intra coding or intraprediction. When the palette mode is applied, a sample value in apicture may be signaled based on information on a palette index and apalette table.

The prediction signal generated through the predictor (including interpredictor 221 and/or the intra predictor 222) may be used to generate areconstructed signal or to generate a residual signal. The transformer232 may generate transform coefficients by applying a transformtechnique to the residual signal. For example, the transform techniquemay include at least one of a discrete cosine transform (DCT), adiscrete sine transform (DST), a Karhunen-Loeve transform (KLT), agraph-based transform (GBT), or a conditionally non-linear transform(CNT). Here, the GBT means transform obtained from a graph whenrelationship information between pixels is represented by the graph. TheCNT refers to transform obtained based on a prediction signal generatedusing all previously reconstructed pixels. In addition, the transformprocess may be applied to square pixel blocks having the same size ormay be applied to blocks having a variable size rather than the squareone.

The quantizer 233 may quantize the transform coefficients and transmitthem to the entropy encoder 240, and the entropy encoder 240 may encodethe quantized signal (information on the quantized transformcoefficients) and output the encoded signal in a bitstream. Theinformation on the quantized transform coefficients may be referred toas residual information. The quantizer 233 may rearrange block typequantized transform coefficients into a one-dimensional vector formbased on a coefficient scan order, and generate information on thequantized transform coefficients based on the quantized transformcoefficients of the one-dimensional vector form. The entropy encoder 240may perform various encoding methods such as, for example, exponentialGolomb, context-adaptive variable length coding (CAVLC),context-adaptive binary arithmetic coding (CABAC), and the like. Theentropy encoder 240 may encode information necessary for video/imagereconstruction other than quantized transform coefficients (e.g. valuesof syntax elements, etc.) together or separately. Encoded information(e.g., encoded video/image information) may be transmitted or stored ona unit basis of a network abstraction layer (NAL) in the form of abitstream. The video/image information may further include informationon various parameter sets such as an adaptation parameter set (APS), apicture parameter set (PPS), a sequence parameter set (SPS), a videoparameter set (VPS) or the like. Further, the video/image informationmay further include general constraint information. In the presentdocument, information and/or syntax elements which aretransmitted/signaled to the decoding apparatus from the encodingapparatus may be included in video/image information. The video/imageinformation may be encoded through the above-described encodingprocedure and included in the bitstream. The bitstream may betransmitted through a network, or stored in a digital storage medium.Here, the network may include a broadcast network, a communicationnetwork and/or the like, and the digital storage medium may includevarious storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, andthe like. A transmitter (not shown) which transmits a signal output fromthe entropy encoder 240 and/or a storage (not shown) which stores it maybe configured as an internal/external element of the encoding apparatus200, or the transmitter may be included in the entropy encoder 240.

Quantized transform coefficients output from the quantizer 233 may beused to generate a prediction signal. For example, by applyingdequantization and inverse transform to quantized transform coefficientsthrough the dequantizer 234 and the inverse transformer 235, theresidual signal (residual block or residual samples) may bereconstructed. The adder 155 adds the reconstructed residual signal to aprediction signal output from the inter predictor 221 or the intrapredictor 222, so that a reconstructed signal (reconstructed picture,reconstructed block, reconstructed sample array) may be generated. Whenthere is no residual for a processing target block as in a case wherethe skip mode is applied, the predicted block may be used as areconstructed block. The adder 250 may be called a reconstructor or areconstructed block generator. The generated reconstructed signal may beused for intra prediction of a next processing target block in thecurrent block, and as described later, may be used for inter predictionof a next picture through filtering.

Meanwhile, in the picture encoding and/or reconstructing process, lumamapping with chroma scaling (LMCS) may be applied.

The filter 260 may improve subjective/objective video quality byapplying the filtering to the reconstructed signal. For example, thefilter 260 may generate a modified reconstructed picture by applyingvarious filtering methods to the reconstructed picture, and may storethe modified reconstructed picture in the memory 270, specifically inthe DPB of the memory 270. The various filtering methods may include,for example, deblocking filtering, sample adaptive offset, an adaptiveloop filter, a bilateral filter or the like. As discussed later in thedescription of each filtering method, the filter 260 may generatevarious information relating to filtering, and transmit the generatedinformation to the entropy encoder 240. The information on the filteringmay be encoded in the entropy encoder 240 and output in the form of abitstream.

The modified reconstructed picture which has been transmitted to thememory 270 may be used as a reference picture in the inter predictor221. Through this, the encoding apparatus can avoid prediction mismatchin the encoding apparatus 100 and a decoding apparatus when the interprediction is applied, and can also improve coding efficiency.

The memory 270 DPB may store the modified reconstructed picture in orderto use it as a reference picture in the inter predictor 221. The memory270 may store motion information of a block in the current picture, fromwhich motion information has been derived (or encoded) and/or motioninformation of blocks in an already reconstructed picture. The storedmotion information may be transmitted to the inter predictor 221 to beutilized as motion information of a neighboring block or motioninformation of a temporal neighboring block. The memory 270 may storereconstructed samples of reconstructed blocks in the current picture,and transmit them to the intra predictor 222.

FIG. 3 is a diagram schematically describing a configuration of avideo/image decoding apparatus to which the present document may beapplied.

Referring to FIG. 3 , the video decoding apparatus 300 may include anentropy decoder 310, a residual processor 320, a predictor 330, an adder340, a filter 350 and a memory 360. The predictor 330 may include aninter predictor 331 and an intra predictor 332. The residual processor320 may include a dequantizer 321 and an inverse transformer 321. Theentropy decoder 310, the residual processor 320, the predictor 330, theadder 340, and the filter 350, which have been described above, may beconstituted by one or more hardware components (e.g., decoder chipsetsor processors) according to an embodiment. Further, the memory 360 mayinclude a decoded picture buffer (DPB), and may be constituted by adigital storage medium. The hardware component may further include thememory 360 as an internal/external component.

When a bitstream including video/image information is input, thedecoding apparatus 300 may reconstruct an image correspondingly to aprocess by which video/image information has been processed in theencoding apparatus of FIG. 2 . For example, the decoding apparatus 300may derive units/blocks based on information relating to block partitionobtained from the bitstream. The decoding apparatus 300 may performdecoding by using a processing unit applied in the encoding apparatus.Therefore, the processing unit of decoding may be, for example, a codingunit, which may be partitioned along the quad-tree structure, thebinary-tree structure, and/or the ternary-tree structure from a codingtree unit or a largest coding unit. One or more transform units may bederived from the coding unit. And, the reconstructed image signaldecoded and output through the decoding apparatus 300 may be reproducedthrough a reproducer.

The decoding apparatus 300 may receive a signal output from the encodingapparatus of FIG. 2 in the form of a bitstream, and the received signalmay be decoded through the entropy decoder 310. For example, the entropydecoder 310 may parse the bitstream to derive information (e.g.,video/image information) required for image reconstruction (or picturereconstruction). The video/image information may further includeinformation on various parameter sets such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), a video parameter set (VPS) or the like. Further, the video/imageinformation may further include general constraint information. Thedecoding apparatus may decode a picture further based on information onthe parameter set and/or the general constraint information. In thepresent document, signaled/received information and/or syntax elements,which will be described later, may be decoded through the decodingprocedure and be obtained from the bitstream. For example, the entropydecoder 310 may decode information in the bitstream based on a codingmethod such as exponential Golomb encoding, CAVLC, CABAC, or the like,and may output a value of a syntax element necessary for imagereconstruction and quantized values of a transform coefficient regardinga residual. More specifically, a CABAC entropy decoding method mayreceive a bin corresponding to each syntax element in a bitstream,determine a context model using decoding target syntax elementinformation and decoding information of neighboring and decoding targetblocks, or information of symbol/bin decoded in a previous step, predictbin generation probability according to the determined context model andperform arithmetic decoding of the bin to generate a symbolcorresponding to each syntax element value. Here, the CABAC entropydecoding method may update the context model using information of asymbol/bin decoded for a context model of the next symbol/bin afterdetermination of the context model. Information on prediction amonginformation decoded in the entropy decoder 310 may be provided to thepredictor (inter predictor 332 and intra predictor 331), and residualvalues, that is, quantized transform coefficients, on which entropydecoding has been performed in the entropy decoder 310, and associatedparameter information may be input to the residual processor 320. Theresidual processor 320 may derive a residual signal (residual block,residual samples, residual sample array). Further, information onfiltering among information decoded in the entropy decoder 310 may beprovided to the filter 350. Meanwhile, a receiver (not shown) whichreceives a signal output from the encoding apparatus may furtherconstitute the decoding apparatus 300 as an internal/external element,and the receiver may be a component of the entropy decoder 310.Meanwhile, the decoding apparatus according to the present document maybe called a video/image/picture coding apparatus, and the decodingapparatus may be classified into an information decoder(video/image/picture information decoder) and a sample decoder(video/image/picture sample decoder). The information decoder mayinclude the entropy decoder 310, and the sample decoder may include atleast one of the dequantizer 321, the inverse transformer 322, the adder340, the filter 350, the memory 360, the inter predictor 332, and theintra predictor 331.

The dequantizer 321 may output transform coefficients by dequantizingthe quantized transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in the form of a two-dimensionalblock. In this case, the rearrangement may perform rearrangement basedon an order of coefficient scanning which has been performed in theencoding apparatus. The dequantizer 321 may perform dequantization onthe quantized transform coefficients using quantization parameter (e.g.,quantization step size information), and obtain transform coefficients.

The dequantizer 322 obtains a residual signal (residual block, residualsample array) by inverse transforming transform coefficients.

The predictor may perform prediction on the current block, and generatea predicted block including prediction samples for the current block.The predictor may determine whether intra prediction or inter predictionis applied to the current block based on the information on predictionoutput from the entropy decoder 310, and specifically may determine anintra/inter prediction mode.

The predictor 320 may generate a prediction signal based on variousprediction methods. For example, the predictor may apply intraprediction or inter prediction for prediction on one block, and, aswell, may apply intra prediction and inter prediction at the same time.This may be called combined inter and intra prediction (CIIP). Further,the predictor may be based on an intra block copy (IBC) prediction mode,or a palette mode in order to perform prediction on a block. The IBCprediction mode or palette mode may be used for content image/videocoding of a game or the like, such as screen content coding (SCC).Although the IBC basically performs prediction in a current block, itcan be performed similarly to inter prediction in that it derives areference block in a current block. That is, the IBC may use at leastone of inter prediction techniques described in the present document.The palette mode may be regarded as an example of intra coding or intraprediction. When the palette mode is applied, information on a palettetable and a palette index may be included in the video/image informationand signaled.

The intra predictor 331 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighbor of or apart from the current block according to theprediction mode. In the intra prediction, prediction modes may include aplurality of non-directional modes and a plurality of directional modes.The intra predictor 331 may determine the prediction mode applied to thecurrent block by using the prediction mode applied to the neighboringblock.

The inter predictor 332 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to reducethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted on a block, subblock, orsample basis based on correlation of motion information between theneighboring block and the current block. The motion information mayinclude a motion vector and a reference picture index. The motioninformation may further include inter prediction direction (L0prediction, L1 prediction, Bi prediction, etc.) information. In the caseof inter prediction, the neighboring block may include a spatialneighboring block existing in the current picture and a temporalneighboring block existing in the reference picture. For example, theinter predictor 332 may configure a motion information candidate listbased on neighboring blocks, and derive a motion vector and/or areference picture index of the current block based on received candidateselection information. Inter prediction may be performed based onvarious prediction modes, and the information on prediction may includeinformation indicating a mode of inter prediction for the current block.

The adder 340 adds obtained residual signal to a prediction signal(predicted block, predicted sample array) output from the predictor(inter predictor 332 and/or intra predictor 331), so that areconstructed signal (reconstructed picture, reconstructed block,reconstructed sample array) may be generated. When there is no residualfor a processing target block as in a case where the skip mode isapplied, the predicted block may be used as a reconstructed block.

The adder 340 may be called a reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for intraprediction of a next processing target block in the current block, andas described later, may be output through filtering or be used for interprediction of a next picture.

Meanwhile, in the picture decoding process, luma mapping with chromascaling (LMCS) may be applied.

The filter 350 may improve subjective/objective video quality byapplying the filtering to the reconstructed signal. For example, thefilter 350 may generate a modified reconstructed picture by applyingvarious filtering methods to the reconstructed picture, and may transmitthe modified reconstructed picture in the memory 360, specifically inthe DPB of the memory 360. The various filtering methods may include,for example, deblocking filtering, sample adaptive offset, an adaptiveloop filter, a bilateral filter or the like.

The (modified) reconstructed picture which has been stored in the DPB ofthe memory 360 may be used as a reference picture in the inter predictor332. The memory 360 may store motion information of a block in thecurrent picture, from which motion information has been derived (ordecoded) and/or motion information of blocks in an already reconstructedpicture. The stored motion information may be transmitted to the interpredictor 260 to be utilized as motion information of a neighboringblock or motion information of a temporal neighboring block. The memory360 may store reconstructed samples of reconstructed blocks in thecurrent picture, and transmit them to the intra predictor 331.

In the present description, embodiments described in the filter 260, theinter predictor 221 and the intra predictor 222 of the encodingapparatus 200 may be similarly or correspondingly applied to the filter350, the inter predictor 332 and the intra predictor 331 of the decodingapparatus 300.

As described above, prediction is performed in order to increasecompression efficiency in performing video coding. Through this, apredicted block including prediction samples for a current block, whichis a coding target block, may be generated. Here, the predicted blockincludes prediction samples in a space domain (or pixel domain). Thepredicted block may be identically derived in the encoding apparatus andthe decoding apparatus, and the encoding apparatus may increase imagecoding efficiency by signaling to the decoding apparatus not originalsample value of an original block itself but information on residual(residual information) between the original block and the predictedblock. The decoding apparatus may derive a residual block includingresidual samples based on the residual information, generate areconstructed block including reconstructed samples by adding theresidual block to the predicted block, and generate a reconstructedpicture including reconstructed blocks.

The residual information may be generated through transform andquantization procedures. For example, the encoding apparatus may derivea residual block between the original block and the predicted block,derive transform coefficients by performing a transform procedure onresidual samples (residual sample array) included in the residual block,and derive quantized transform coefficients by performing a quantizationprocedure on the transform coefficients, so that it may signalassociated residual information to the decoding apparatus (through abitstream). Here, the residual information may include valueinformation, position information, a transform technique, transformkernel, a quantization parameter or the like of the quantized transformcoefficients. The decoding apparatus may perform aquantization/dequantization procedure and derive the residual samples(or residual sample block), based on residual information. The decodingapparatus may generate a reconstructed block based on a predicted blockand the residual block. The encoding apparatus may derive a residualblock by dequantizing/inverse transforming quantized transformcoefficients for reference for inter prediction of a next picture, andmay generate a reconstructed picture based on this.

When inter prediction is applied, the predictor of the encodingapparatus/decoding apparatus may perform the inter prediction on a blockunit basis and derive the prediction sample. Inter prediction can be aprediction derived in a manner that is dependent on data elements (e.g.,sample values or motion information) of picture(s) other than thecurrent picture. When inter prediction is applied to the current block,a predicted block (prediction sample array) for the current block may bederived based on a reference block (reference sample array) specified bya motion vector on a reference picture which a reference picture indexindicates. At this time, in order to reduce the amount of motioninformation transmitted in the inter prediction mode, the motioninformation of the current block may be predicted on a unit basis of ablock, a subblock, or a sample based on correlation of motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter prediction type(L0 prediction, L1 prediction, Bi prediction, etc.) information. Wheninter prediction is applied, the neighboring block may include a spatialneighboring block existing in the current picture and a temporalneighboring block existing in the reference picture. The referencepicture including the reference block and the reference pictureincluding the temporal neighboring block may be same to each other ordifferent from each other. The temporal neighboring block may be calleda collocated reference block, a collocated CU (colCU), and the like, andthe reference picture including the temporal neighboring block may becalled a collocated picture (colPic). For example, motion informationcandidate list may be configured based on neighboring blocks of thecurrent block, and a flag or index information indicating whichcandidate is selected (used) in order to derive a motion vector and/or areference picture index of the current block may be signaled. Interprediction may be performed based on various prediction modes. Forexample, in the case of a skip mode and a (normal) merge mode, motioninformation of the current block may be the same as motion informationof the selected neighboring block. In the skip mode, unlike the mergemode, the residual signal may not be transmitted. In the case of motioninformation prediction (motion vector prediction (MVP)) mode, a motionvector of the selected neighboring block may be used as a motion vectorpredictor, and a motion vector difference may be signaled. In this case,a motion vector of the current block may be derived using the sum of themotion vector predictor and motion vector difference.

The video/image encoding procedure based on inter prediction mayschematically include, for example, the following.

FIG. 4 represents an example of an inter prediction based video/imageencoding method.

The encoding apparatus performs inter prediction on a current block(S400). The encoding apparatus may derive inter prediction mode andmotion information of the current block, and generate prediction samplesof the current block. Here, inter prediction mode determination, motioninformation derivation, and prediction sample generation procedure maybe performed at the same time, or performed one after another. Forexample, the inter predictor of the encoding apparatus may include aprediction mode determining part, a motion information deriving part,and a predicted sample deriving part. The prediction mode determiningpart may determine a prediction mode for the current block, the motioninformation deriving part may derive motion information of the currentblock, and the prediction sample deriving part may derive predictedsamples of the current block. For example, the inter predictor of theencoding apparatus may search for a block similar to the current blockin a certain region (search region) of the reference pictures throughmotion estimation, and derive a reference block whose difference fromthe current block is minimum, or less than or equal to a certain level.Based on this, the reference picture index indicating a referencepicture on which the reference block is located may be derived, andbased on the difference in position between the reference block and thecurrent block, the motion vector may be derived. The encoding apparatusmay determine a mode from among various prediction modes, which isapplied to the current block. The encoding apparatus may compare RDcosts for the various prediction modes, and determine the optimalprediction mode for the current block.

For example, when the skip mode or the merge mode is applied to thecurrent block, the encoding apparatus may configure a merge candidatelist to be described later, and derive a reference block whosedifference from the current block is minimum or less than or equal to acertain level from among reference blocks which merge candidatesincluded in the merge candidate list indicate. In this case, the mergecandidate associated with the derived reference block may be selected,and merge index information indicating the selected merge candidate maybe generated and be signaled to the decoding apparatus. The motioninformation of the current block may be derived using motion informationof the selected merge candidate.

As another example, when the (A)MVP mode is applied to the currentblock, the encoding apparatus may configure an (A)MVP candidate list,and use the motion vector of an mvp (motion vector predictor) candidateselected from among mvp candidates included in the (A)MVP candidate listas the mvp of the current block. In this case, for example, the motionvector indicating the reference block derived by the above-describedmotion estimation may be used as a motion vector of the current block,and among the mvp candidates, the mvp candidate which has a motionvector whose difference from the motion vector of the current block issmallest may be the selected mvp candidate. MVD (motion vectordifference), which is a difference obtained by subtracting the mvp fromthe motion vector of the current block, may be derived. In this case,information on the MVD may be signaled to the decoding apparatus.Additionally, when the (A)MVP mode is applied, a value of the referencepicture index may be configured as a reference picture index informationand signaled separately to the decoding apparatus.

The encoding apparatus may derive residual samples based on theprediction samples (S410). The encoding apparatus may derive theresidual samples via comparison of original samples of the current blockand the prediction samples.

The encoding apparatus encodes image information including predictioninformation and residual information (S420). The encoding apparatus mayoutput the encoded image information in the form of a bitstream. Theprediction information may include a prediction mode information (e.g.,skip flag, merge flag, mode index or the like) and information on motioninformation as information on the prediction procedure. The informationon motion information may include candidate selection information (e.g.,merge index, mvp flag, or mvp index), which is information for derivinga motion vector. Further, the information on motion information mayinclude information on the above-described MVD, and/or the referencepicture index information. Further, the information on motioninformation may include information indicating whether the L0prediction, the L1 prediction, or bi-prediction is applied. The residualinformation is information on the residual samples. The residualinformation may include information on quantized transform coefficientsfor the residual samples.

The output bitstream may be stored in a (digital) storage medium anddelivered to the decoding apparatus, or may be delivered to the decodingapparatus through a network.

Meanwhile, as described above, the encoding apparatus may generate areconstructed picture (including reconstructed samples and areconstructed block) based on the reference samples and the residualsamples. This is to derive the same prediction result in the encodingapparatus as one that is performed in the decoding apparatus, and thereason is that coding efficiency can be increased through this.Therefore, the encoding apparatus may store a reconstructed picture (orreconstructed samples, a reconstructed block) in the memory, and utilizeit as a reference picture for inter prediction. The in-loop filteringprocedure may be further applied to the reconstructed picture asdescribed above.

The video/image decoding procedure based on inter prediction mayschematically include, for example, the following.

FIG. 5 represents an example of an inter prediction based video/imagedecoding method.

Referring to FIG. 5 , the decoding apparatus may perform an operationcorresponding to the operation which has been performed in the encodingapparatus. The decoding apparatus may perform prediction on the currentblock and derive the prediction samples based on the received predictioninformation.

Specifically, the decoding apparatus may determine the prediction modefor the current block based on the received prediction information(S500). The decoding apparatus may determine which inter prediction modeis applied to the current block based on the prediction mode informationin the prediction information.

For example, it may be determined based on the merge flag whether themerge mode is applied to the current block or (A)MVP mode is determined.Alternatively, one inter prediction mode may be selected from amongvarious inter prediction mode candidates based on the mode index. Theinter prediction mode candidates may include the skip mode, the mergemode and/or the (A)MVP mode, or may include various inter predictionmodes to be described later.

The decoding apparatus derives the motion information of the currentblock based on the determined inter prediction mode (S510). For example,when the skip mode or the merge mode is applied to the current block,the decoding apparatus may configure a merge candidate list to bedescribed later, and select one of merge candidates included in themerge candidate list. The selection may be performed based on theabove-described selection information (merge index). The motioninformation of the current block may be derived using motion informationof the selected merge candidate. The motion information of the selectedmerge candidate may be used as the motion information of the currentblock.

As another example, when the (A)MVP mode is applied to the currentblock, the decoding apparatus may configure an (A)MVP candidate list tobe described later, and use a motion vector of a motion vector predictor(MVP) candidate selected from among mvp candidates included in the(A)MVP candidate list as the MVP of the current block. The selection maybe performed based on the above-described selection information (mvpflag or mvp index). In this case, MVD of the current block may bederived based on information on the MVD, and the motion vector of thecurrent block may be derived based on the MVD and the mvp of the currentblock. Further, the reference picture index of the current block may bederived based on the reference picture index information. The picture inthe reference picture list concerning the current block, which thereference picture index indicates may be derived as a reference picturewhich is referred to for the inter prediction of the current block.

Meanwhile, as described later, the motion information of the currentblock may be derived without configuring the candidate list, and in thiscase, the motion information of the current block may be derivedaccording to the procedure disclosed in the prediction mode to bedescribed later. In this case, the configuring of the candidate list asdescribed above may be omitted.

The decoding apparatus may generate prediction samples for the currentblock based on the motion information of the current block (S520). Inthis case, the reference picture may be derived based on the referencepicture index of the current block, and the prediction samples of thecurrent block may be derived using the samples of the reference block onthe reference picture which is indicated by the motion vector of thecurrent block. In this case, a prediction sample filtering procedure forthe all or some of prediction samples of the current block may befurther performed according to circumstances as described later.

For example, the inter predictor of the encoding apparatus may include aprediction mode determining part, a motion information deriving part,and a predicted sample deriving part, may determine a prediction modefor the current block based on prediction mode information received atthe prediction mode determining part, may derive motion information(motion vector and/or reference picture index and/or the like) of thecurrent block based on information on motion information received at themotion information deriving part, and may derive predicted samples ofthe current block at the prediction sample deriving part.

The decoding apparatus generates the residual samples for the currentblock based on the received residual information (S530). The decodingapparatus may generate the reconstructed samples for the current blockbased on the residual samples and the prediction samples, and generatethe reconstructed picture based on the reconstructed samples. (S540).Hereinafter, the in-loop filtering procedure may be applied to thereconstructed picture as described above.

FIG. 6 illustratively represents an inter prediction procedure.

Referring to FIG. 6 , as described above, the inter prediction proceduremay include determining an inter prediction mode, deriving motioninformation according to the determined prediction mode, and performingprediction based on the derived motion information (generating aprediction sample). The inter prediction procedure may be performed inthe encoding apparatus and the decoding apparatus as described above. Inthe present document, a coding apparatus may include an encodingapparatus and/or a decoding apparatus.

Referring to FIG. 6 , the coding apparatus determines an interprediction mode for a current block (S600). Various inter predictionmodes may be used for prediction of the current block in a picture. Forexample, a variety of modes, such as a merge mode, a skip mode, a motionvector prediction (MVP) mode, an affine mode, a subblock merge mode, amerge with MVD mode or the like, may be used. A decoder side motionvector refinement (DMVR) mode, an adaptive motion vector resolution(AMVR) mode, bi-prediction with CU-level weight (BCW), bi-directionaloptical flow (BDOF) or the like may be used as an additional mode, or asa substitute. The affine mode may be called an affine motion predictionmode. The MVP mode may be called an advanced motion vector prediction(AMVP) mode. In the present document, some modes and/or a motioninformation candidate derived by some modes may be included as one ofcandidates relating to motion information of another mode. For example,the HMVP candidate may be added as a merge candidate of the merge/skipmode, or may be added as an MVP candidate of the MVP mode. When the HVMPcandidate is used as a motion information candidate of the merge mode orthe skip mode, the HVMP candidate may be called an HMVP merge candidate.

The prediction mode information indicating the inter prediction mode ofthe current block may be signaled from the encoding apparatus to thedecoding apparatus. The prediction mode information may be included in abitstream and received at the decoding apparatus. The prediction modeinformation may include index information indicating one of multiplecandidate modes. Further, the inter prediction mode may be indicatedthrough hierarchical signaling of flag information. In this case, theprediction mode information may include one or more flags. For example,it may be indicated whether the skip mode is applied by signaling theskip flag, it may be indicated whether the merge mode is applied bysignaling the merge flag for the skip mode not being applied, and it maybe indicated that the MVP mode is applied or a flag for furtherpartition may be further signaled when the merge mode is not applied.The affine mode may be signaled as an independent mode, or may besignaled as a mode dependent on the merge mode, the MVP mode or thelike. For example, the affine mode may include an affine merge mode andan affine MVP mode.

The coding apparatus derives motion information for the current block(S610). The deriving of the motion information may be derived based onthe inter prediction mode.

The coding apparatus may perform inter prediction using motioninformation for the current block. The encoding apparatus may deriveoptimal motion information for the current block through a motionestimation procedure. For example, the encoding apparatus may search asimilar reference block of a high correlation in a predetermined searchrange in a reference picture in a fractional pixel unit using anoriginal block in an original picture for the current block, and mayderive motion information through this. Similarity of a block may bederived based on difference between phase-based sample values. Forexample, similarity of a block may be calculated based on SAD betweenthe current block (or template of the current block) and the referenceblock (or template of the reference block). In this case, the motioninformation may be derived based on the reference block having thesmallest SAD in a search region. The derived motion information may besignaled to the decoding apparatus according to various methods based oninter prediction mode.

The coding apparatus performs inter prediction based on motioninformation for the current block (S620). The coding apparatus mayderive prediction sample(s) for the current block based on the motioninformation. The current block including the prediction samples may becalled a predicted block.

Meanwhile, in the case of inter prediction, inter prediction method inwhich the distortion of image is considered is being proposed.Specifically, there is proposed an affine motion model which efficientlyderives the motion vector for sample blocks or sub-blocks of the currentblock, and which increases the accuracy of inter prediction despitedeformation such as rotation, zoom in, zoom out of an image. That is,the affine motion model is one that derives the motion vector for samplepoints or sub-blocks of the current block, and the prediction using theaffine motion model may be called an affine motion prediction, an affinemotion prediction, motion prediction of a sub-block unit or a sub-blockmotion prediction.

For example, the sub-block motion prediction using the affine motionmodel may efficiently express such four motions as described later, thatis, such four deformations as described later.

FIG. 7 illustratively represents motions which are expressed through anaffine motion model. Referring to FIG. 7 , the motions which can beexpressed through the affine motion model may include translate motion,scale motion, rotate motion and shear motion. That is, as shown in FIG.7 , the translate motion that an image (or a part thereof) is moved in aplane over time, the scale motion that an image (or a part thereof) isscaled over time, the rotate motion that an image (or a part thereof) isrotated over time, and the shear motion that an image (or a partthereof) is deformed to a parallelogram over time may be efficientlyexpressed through motion prediction of the sub-block unit.

The encoding apparatus/decoding apparatus may predict distortion shapeof the image based on motion vectors at control points (CP) of thecurrent block through the affine inter prediction, which can lead toincrease in prediction accuracy, thus improving compression performanceof an image. Further, by using the motion vector of the neighboringblock of the current block, a motion vector for at least one controlpoint of the current block may be derived, and thus it is possible toreduce data amount of added additional information, and considerablyimprove inter prediction efficiency.

As one example of the affine motion prediction, motion information atthree control points, that is, three reference points may be required.

FIG. 8 illustratively represents the affine motion model in which motionvectors for three control points are used.

If a top-left sample position in the current block 800 is set as (0, 0),as shown in FIG. 8 , sample positions (0, 0), (w, 0), (0, h) may bedetermined as the control points. Hereinafter, the control point of (0,0) sample position may be represented as CP0; the control point of (w,0) sample position, CP1; and the control point of (0, h) sampleposition, CP2.

By using each of the above-described control points and the motionvector for the corresponding control point, an equation for the affinemotion model may be derived. The equation for the affine motion modelmay be represented as below:

$\begin{matrix}\left\{ \begin{matrix}{v_{x} = {{\frac{\left( {v_{1x} - v_{0x}} \right)}{w}*x} + {\frac{\left( {v_{2x} - v_{0x}} \right)}{h}*y} + v_{0x}}} \\{v_{y} = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}*x} - {\frac{\left( {v_{2y} - v_{0y}} \right)}{h}*y} + v_{0y}}}\end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 1} \right\rbrack\end{matrix}$

where w represents a width of the current block 800; h, a height of thecurrent block 800; v0x and v0y, an x component and y component of themotion vector of CP0, respectively; v1x and vly, an x component and ycomponent of the motion vector of CP1, respectively; and v2x and v2y, anx component and y component of the motion vector of CP2, respectively.Further, x represents an x component of a position of a target sample inthe current block 800; y, a y component of the position of the targetsample in the current block 800; vx, an x component of a motion vectorof the target sample in the current block 800; and vy, a y component ofthe motion vector of the target sample in the current block 800.

Since the motion vector of CP0, the motion vector of CP1, and the motionvector of CP2 are known, the motion vector according to the sampleposition in the current block may be derived based on Equation 1. Thatis, according to the affine motion model, the motion vectors v0(v0x,v0y), v1(v1x, v1y), v2(v2x, v2y) at the control points may be scaledbased on ratios of distances between coordinates (x, y) of the targetsample and three control points, so that the motion vector of the targetsample according to the target sample position may be derived. That is,according to the affine motion model, the motion vector of each samplein the current block may be derived based on the motion vectors of thecontrol points. Meanwhile, a set of the motion vectors of the samples inthe current block which have been derived according to the affine motionmodel may be represented as an affine motion vector field (MVF).

Meanwhile, six parameters for Equation 1 above may be represented as a,b, c, d, e and f of following equations, and equation for the affinemotion model which is represented using the six parameters may be asbelow:

$\begin{matrix}\begin{matrix}{{a = {{\frac{\left( {\nu_{1x} - \nu_{0x}} \right)}{w}\mspace{14mu} b} = {{\frac{\left( {\nu_{2x} - \nu_{0x}} \right)}{h}\mspace{14mu} c} = v_{0x}}}}\mspace{14mu}} \\{{d = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}\mspace{14mu} e} = {{{- \frac{\left( {v_{2y} - v_{0y}} \right)}{h}}\mspace{14mu} f} = v_{0y}}}}\left\{ \begin{matrix}{v_{x} = {{a*x} + {b*y} + c}} \\{v_{y} = {{d*x} + {e*y} + f}}\end{matrix} \right.}\end{matrix} & \left\lbrack {{Equation}\mspace{14mu} 2} \right\rbrack\end{matrix}$

where w represents a width of the current block 800; h, a height of thecurrent block 800; v0x and v0y, an x component and y component of themotion vector of CP0, respectively; v1x and v1y, an x component and ycomponent of the motion vector of CP0, respectively; and v2x and v2y, anx component and y component of the motion vector of CP1, respectively.Further, x represents an x component of a position of a target sample inthe current block 800; y, a y component of the position of the targetsample in the current block 800; vx, an x component of a motion vectorof the target sample in the current block 800; and vy, a y component ofthe motion vector of the target sample in the current block 800.

The affine motion model using the six parameters or the affine interprediction may be represented as 6-parameter affine motion model or AF6.

Further, as one example of the affine motion prediction, motioninformation at two control points, that is, two reference points may berequired.

FIG. 9 illustratively represents a motion model of the affine unit inwhich motion vectors for two control points are used. The affine motionmodel using two control points may express three motions including thetranslate motion, the scale motion and the rotate motion. The affinemotion model expressing three motions may be represented as a similarityaffine motion model or a simplified affine motion model.

If a top-left sample position in the current block 900 is set as (0, 0),as shown in FIG. 9 , sample positions (0,0), (w, 0) may be determined asthe control points. Hereinafter, the control point of (0, 0) sampleposition may be represented as CP0; and the control point of (w, 0)sample position, CP0.

By using each of the above-described control points and the motionvector for the corresponding control point, an equation for the affinemotion model may be derived. The equation for the affine motion modelmay be represented as below:

$\begin{matrix}\left\{ \begin{matrix}{v_{x} = {{\frac{\left( {v_{1x} - v_{0x}} \right)}{w}*x} - {\frac{\left( {v_{1y} - v_{0y}} \right)}{w}*y} + v_{0x}}} \\{v_{y} = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}*x} - {\frac{\left( {v_{1x} - v_{0x}} \right)}{w}*y} + v_{0y}}}\end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 3} \right\rbrack\end{matrix}$

where w represents a width of the current block 900; v0x and v0y, an xcomponent and y component of the motion vector of CP0, respectively; v1xand v1y, an x component and y component of the motion vector of CP0,respectively. Further, x represents an x component of a position of atarget sample in the current block 900; y, a y component of the positionof the target sample in the current block 900; vx, an x component of amotion vector of the target sample in the current block 900; and vy, a ycomponent of the motion vector of the target sample in the current block900.

Meanwhile, four parameters for Equation 3 above may be represented as a,b, c and d of following equations, and equation for the affine motionmodel which is represented using the four parameters may be as below:

$\begin{matrix}{{a = {{\frac{\left( {v_{1x} - v_{0x}} \right)}{w}\mspace{14mu} b} = {{\frac{\left( {\nu_{1y} - v_{0y}} \right)}{w}\mspace{14mu} c} = {{v_{0x}\mspace{14mu} d} = v_{0y}}}}}\left\{ \begin{matrix}{v_{x} = {{a*x} - {b*y} + c}} \\{v_{y} = {{b*x} + {a*y} + d}}\end{matrix} \right.} & \left\lbrack {{Equation}\mspace{14mu} 4} \right\rbrack\end{matrix}$

where w represents a width of the current block 900; v0x and v0y, an xcomponent and y component of the motion vector of CP0, respectively; v1xand v1y, an x component and y component of the motion vector of CP0,respectively. Further, x represents an x component of a position of atarget sample in the current block 900; y, a y component of the positionof the target sample in the current block 900; vx, an x component of amotion vector of the target sample in the current block 900; and vy, a ycomponent of the motion vector of the target sample in the current block900. Since the affine motion model using the two control points may beexpressed with four parameters a, b, c and d as in Equation 4, theaffine motion model or the affine motion prediction using the fourparameters may be represented as 4-parameter affine motion model or AF4.That is, according to the affine motion model, the motion vector of eachsample in the current block may be derived based on the motion vectorsof the control points. Meanwhile, a set of the motion vectors of thesamples in the current block which have been derived according to theaffine motion model may be represented as an affine motion vector field(MVF).

Meanwhile, as described above, the motion vector of the sample unit maybe derived through the affine motion model, and the accuracy of interprediction can be considerably improved through this. However, in thiscase, complexity may be greatly increased in the motion compensationprocess.

Thus, it may be limited to derive the motion vector of the sub-blockunit in the current block instead of the motion vector of the sampleunit.

FIG. 10 illustratively represents a method of deriving a motion vectorin a subblock unit based on the affine motion model. FIG. 10illustratively represents a case where the size of the current block is16×16, and the motion vector is derived in 4×4 sub-block units. Thesub-block may be set in various sizes, and for example, if the sub-blockis set in an n×n size (n is a positive integer, and for example, n is4), the motion vector may be derived in an n×n sub-block unit in thecurrent block based on the affine motion model, and various method forderiving a motion vector representing each sub-block may be applied.

For example, referring to FIG. 10 , the motion vector of each sub-blockmay be derived setting a center or center lower right side sampleposition of each sub-block as representative coordinates. Here, thecenter lower right side position may represent a sample position amongfour samples located at the center of the sub-block, which is located ata lower right side. For example, if n is an odd number, one sample maybe located at the center of the sub-block, and in this case, the centersample position may be used for deriving the motion vector of thesub-block. However, if n is an even number, four samples may be locatedadjacent to the center of the sub-block, and in this case, the lowerright side sample position may be used for deriving the motion vector.For example, referring to FIG. 10 , representative coordinates for eachof the sub-blocks may be derived as (2, 2), (6, 2), (10, 2), . . . (14,14), and the encoding apparatus/decoding apparatus may derive the motionvector of each sub-block by inputting each of the representativecoordinates of the sub-blocks into Equations 1 to 3. Predicting themotion of the sub-block in the current block through the affine motionmodel may be named motion prediction of sub-block unit or sub-blockmotion prediction, and such motion vectors of sub-blocks may berepresented as MVF.

Meanwhile, as one example, the size of the sub-block in the currentblock may be derived based on the following equation:

$\begin{matrix}\left\{ \begin{matrix}{M = {{clip}\; 3\left( {4,w,\frac{w*{MvPre}}{\max\mspace{11mu}\left( {{{abs}\left( {v_{1x} - v_{0x}} \right)},{{abs}\left( {v_{1y} - v_{0y}} \right)}} \right)}} \right)}} \\{N = {{clip}\; 3\left( {4,h,\frac{h*{MvPre}}{\left. {{{abs}\left( {v_{2x} - v_{0x}} \right)},{{abs}\left( {v_{2\; y} - v_{0y}} \right)}} \right)}} \right)}}\end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 5} \right\rbrack\end{matrix}$

where M represents a width of the sub-block; and N, a height of thesub-block. Further, v0x and v0y represent an x component and y componentof CPMV0 of the current block, respectively; v1x and v1y, an x componentand y component of CPMV1 of the current block, respectively; w, a widthof the current block; h, a height of the current block; and MvPre,motion vector fraction accuracy. For example, the motion vector fractionaccuracy may be set as 1/16.

Meanwhile, in the inter prediction using above-described affine motionmodel, that is, the affine motion prediction, there may exist a mergemode (AF_MERGE) and an affine inter mode (AF_INTER). Here, the affineinter mode may be represented as an affine motion vector prediction mode(affine MVP mode, AF_MVP).

The merge mode using the affine motion model is similar to the existingmerge mode in that MVD for motion vectors of the control points is nottransmitted. That is, like the existing skip/merge mode, the merge modeusing the affine motion model may represent an encoding/decoding methodwhich performs prediction by deriving CPMV for each of two or threecontrol points from the neighboring block of the current block withoutdecoding for MVD (motion vector difference).

For example, if the AF_MRG mode is applied to the current block, MV forCP0 and CP0 (i.e., CPMV0 and CPMV1) may be derived from the neighboringblock among the neighboring blocks of the current block, to which theprediction mode using the affine mode, that is, the affine motionprediction has been applied. That is, CPMV0 and CPMV1 of the neighboringblock to which the affine mode has been applied may be derived as themerge candidate, and the merge candidate may be derived as CPMV0 andCPMV1 for the current block.

The affine inter mode may represent inter prediction in which predictionbased on affine MVF is performed by deriving MVP (motion vectorpredictor) for motion vectors of the control points, deriving motionvectors of the control points based on the MVP and received MVP, andderiving affine MVF of the current block based on the motion vectors ofthe control points. Here, the motion vector of the control point may berepresented as a control point motion vector (CPMV); MVP of the controlpoint, a control point motion vector predictor (CPMVP); and MVD of thecontrol point, control point motion vector difference (CPMVD).Specifically, for example, the encoding apparatus may derive the controlpoint motion vector predictor (CPMVP) and the control point motionvector (CPMV) for each of CP0 and CP1 (or CP0, CP1 and CP2), and maytransmit or store information on the CPMVP and/or CPMVD which is adifference value between the CPMVP and CPMV.

Here, if the affine inter mode is applied to the current block, theencoding apparatus/decoding apparatus may constitute an affine MVPcandidate list based on the neighboring block of the current block, andthe affine MVP candidate may be referred to as CPMVP pair candidate, andthe affine MVP candidate list may be referred to as CPMVP candidatelist.

Further, each affine MVP candidate may mean combination of CPMVPs of CP0and CP1 in the four-parameter affine motion model (four parameter affinemotion model), and may mean combination of CPMVPs of CP0, CP1 and CP2 inthe six-parameter affine motion model.

Meanwhile, with regard to the affine inter prediction, an inheritedaffine candidate or an inherited candidate, and a constructed affinecandidate are being considered for the affine MVP candidate listconfiguration. The inherited candidate may refer to a candidate that themotion information of the neighboring block of the current block withoutother modification or combination, that is, CPMV itself of theneighboring block, is added into the motion candidate list of thecurrent block. Here, the neighboring blocks may include a bottom-leftcorner neighboring block A0, left neighboring block A1, top neighboringblock B0, top-right corner neighboring block B1, and top-left cornerneighboring block B2 of the current block. The constructed affinecandidate means an affine candidate which configures CPMV of the currentblock by the combination of CPMWs of at least two neighboring blocks.The driving of the constructed affine candidate will be described indetail below.

Here, the inherited affine candidate may be like following.

For example, when the neighboring block of the current block is anaffine block, and the reference picture of the current block is the sameas the reference picture of the neighboring block, the affine MVP pairof the current block may be determined from the affine motion model ofthe neighboring block. Here, the affine block may represent a block towhich the affine inter prediction is applied. The inherited affinecandidate may represent CPMVPs (e.g., the affine MVP pair) which hasbeen derived based on the affine motion model of the neighboring block.

Specifically, for example, the inherited affine candidate may be derivedas described below.

FIG. 11 illustratively represents neighboring blocks for deriving theinherited affine candidate.

Referring to FIG. 11 , the neighboring blocks of the current block mayinclude a left neighboring block A0 of the current block, a bottom-leftcorner neighboring block A1 of the current block, a top neighboringblock B0 of the current block, a top-right corner neighboring block B1of the current block, and a top-left corner neighboring block B2 of thecurrent block.

For example, if a size of the current block is W×H, and x component ofthe top-left sample position of the current block is 0 and y componentthereof is 0, the left neighboring block may be a block including asample at coordinates (−1, H−1); the top neighboring block, a blockincluding a sample at coordinates (W−1, −1); the top-right cornerneighboring block, a block including a sample at coordinates (W, −1);the bottom-left corner neighboring block, a block including a sample atcoordinates (−1, H); and the top-left corner neighboring block, a blockincluding a sample at coordinates (−1, −1).

The encoding apparatus/decoding apparatus may check the neighboringblocks A0, A1, B0, B1, and B2 sequentially, and, if the neighboringblock has been coded using the affine motion model, and the referencepicture of the current block is the same as the reference picture of theneighboring block, may derive two CPMVs or three CPMVs of the currentblock based on the affine motion model of the neighboring block. TheCPMVs may be derived as an affine MVP candidate of the current block.The affine MVP candidate may represent the inherited affine candidate.

As one example, up to two inherited affine candidates may be derivedbased on the neighboring blocks.

For example, the encoding apparatus/decoding apparatus may derive thefirst affine MVP candidate of the current block based on a first blockin the neighboring blocks. Here, the first block may be coded with theaffine motion model, and the reference picture of the first block may bethe same as the reference picture of the current block. That is, thefirst block may be a block which has been first confirmed to satisfy acondition while checking neighboring blocks in a specific order. Thecondition may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block.

Hereinafter, the encoding apparatus/decoding apparatus may derive asecond affine MVP candidate of the current block based on a second blockin the neighboring blocks. Here, the second block may be coded with theaffine motion model, and the reference picture of the second block maybe the same as the reference picture of the current block. That is, thesecond block may be a block which has been second confirmed to satisfy acondition while checking neighboring blocks in a specific order. Thecondition may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block.

Meanwhile, for example, when the number of the available inheritedaffine candidates is less than two (that is, the number of derivedinherited affine candidates is less than two), the constructed affinecandidate may be considered. The configured affine candidate may bederived as below.

FIG. 12 illustratively represents a spatial candidate for theconstructed affine candidate.

As shown in FIG. 12 , motion vectors of the neighboring blocks of thecurrent block may be divided into three groups. Referring to FIG. 12 ,the neighboring blocks may include a neighboring block A, a neighboringblock B, a neighboring block C, a neighboring block D, a neighboringblock E, a neighboring block F, and a neighboring block G.

The neighboring block A may represent a neighboring block located topleft of a top-left sample position of the current block; the neighboringblock B, a neighboring block located top of the top-left sample positionof the current block; and the neighboring block C, a neighboring blocklocated left of the top-left sample position of the current block. Inaddition, the neighboring block D may represent a neighboring blocklocated top of a top-right sample position of the current block; and theneighboring block E, a neighboring block located top right of thetop-right sample position of the current block. In addition, theneighboring block F may represent a neighboring block located left of abottom-left sample position of the current block; and the neighboringblock G, a neighboring block located bottom left of the bottom-leftsample position of the current block.

For example, the three groups may include S₀, S₁, and S₂, and the S₀,the S₁ and the S₂ may be derived as following Table.

TABLE 1 S₀ = {mv_(A), mv_(B), mv_(C)} S₁ = {mv_(D), mv_(E)} S₂ ={mv_(F), mv_(G)}

where mv_(A) represents a motion vector of the neighboring block A;mv_(B), a motion vector of the neighboring block B; mv_(C), a motionvector of the neighboring block C; mv_(D), a motion vector of theneighboring block D; mv_(E), a motion vector of the neighboring block E;mv_(F), a motion vector of the neighboring block F; and mv_(G), a motionvector of the neighboring block G. The S₀ may be represented as a firstgroup; the S₁, as a second group; and the S₂, as a third group.

The encoding apparatus/decoding apparatus may derive mv₀ from the S₀,may derive mv₁ from the S₁, may derive mv₂ from the S₂, and may derivethe affine MVP candidate which includes the mv₀, the mv₁, and the mv₂.The affine MVP candidate may represent the constructed affine candidate.Further, the mv₀ may be a CPMVP candidate of CP0; the mv₁, a CPMVPcandidate of CP1; and the mv₂, a CPMVP candidate of CP2.

Here, a reference picture for the mv₀ may be the same as a referencepicture of the current block. That is, the mv₀ may be a motion vectorwhich has been first confirmed to satisfy a condition while checkingmotion vectors in the S₀ in a specific order. The condition may be thatthe reference picture for the motion vector should be the same as thereference picture of the current block. The specific order may be thefollowing one: the neighboring block A→the neighboring block B→theneighboring block C in the S₀. Further, it may be performed in an orderother than the forgoing order, and may not be limited to the forgoingexample.

Further, the reference picture for the mv₁ may be the same as thereference picture of the current block. That is, the mv₁ may be a motionvector which has been first confirmed to satisfy a condition whilechecking motion vectors in the S₁ in a specific order. The condition maybe that the reference picture for the motion vector should be the sameas the reference picture of the current block. The specific order may bethe following one: the neighboring block D→the neighboring block E inthe S₁. Further, it may be performed in an order other than the forgoingorder, and may not be limited to the forgoing example.

Further, the reference picture for the mv₂ may be the same as thereference picture of the current block. That is, the mv₂ may be a motionvector which has been first confirmed to satisfy a condition whilechecking motion vectors in the S₂ in a specific order. The condition maybe that the reference picture for the motion vector should be the sameas the reference picture of the current block. The specific order may bethe following one: the neighboring block F→the neighboring block G inthe S₂. Further, it may be performed in an order other than the forgoingorder, and may not be limited to the forgoing example.

Meanwhile, when only the mv₀ and the mv₁ are available, that is whenonly the mv₀ and the mv₁ are derived, the mv₂ may be derived as thefollowing equation.

$\begin{matrix}{{{\overset{\_}{mv}}_{2}^{x} = {{\overset{\_}{mv}}_{0}^{x} - {h\frac{\left( {{\overset{\_}{mv}}_{1}^{y} - {\overset{\_}{mv}}_{0}^{y}} \right)}{w}}}},{{\overset{\_}{mv}}_{2}^{y} = {{\overset{\_}{mv}}_{0}^{y} + {h\frac{\left( {{\overset{\_}{mv}}_{1}^{x} - {\overset{\_}{mv}}_{0}^{x}} \right)}{w}}}}} & \left\lbrack {{Equation}\mspace{14mu} 6} \right\rbrack\end{matrix}$

where mv₂ ^(x) represents an x component of the mv₂; mv₂ ^(y), a ycomponent of the mv₂; mv₀ ^(x), an x component of the mv₀; mv₀ ^(y), a ycomponent of the mv₀; mv₁ ^(x), an x component of the mv₁; and mv₁ ^(y),a y component of the mv₁. Further, w represents the width of the currentblock, and h represents the height of the current block.

Meanwhile, when only the mv₀ and the mv₂ are derived, the mv₁ may bederived as the following equation.

$\begin{matrix}{{{\overset{\_}{mv}}_{1}^{x} = {{\overset{\_}{mv}}_{0}^{x} + {h\frac{\left( {{\overset{\_}{mv}}_{2}^{y} - {\overset{\_}{mv}}_{0}^{y}} \right)}{w}}}},{{\overset{\_}{mv}}_{1}^{y} = {{\overset{\_}{mv}}_{0}^{y} - {h\frac{\left( {{\overset{\_}{mv}}_{2}^{x} - {\overset{\_}{mv}}_{0}^{x}} \right)}{w}}}}} & \left\lbrack {{Equation}\mspace{14mu} 7} \right\rbrack\end{matrix}$

where mv₁ ^(x) represents an x component of the mv₁; mv₁ ^(y), a ycomponent of the mv₁; mv₀ ^(x), an x component of the mv₀; mv₀ ^(y), a ycomponent of the mv₀; mv₂ ^(x), an x component of the mv₂; and mv₂ ^(y),a y component of the mv₂. Further, w represents the width of the currentblock, and h represents the height of the current block.

Further, when the number of the available inherited affine candidateand/or the constructed affine candidate is less than two, the AMVPprocess of the conventional HEVC standard may be applied to the affineMVP list configuration. That is, when the number of the availableinherited affine candidate and/or the constructed affine candidate isless than two, the process to configure an MVP candidate in theconventional HEVC standard may be performed.

Meanwhile, the flow charts of examples of configuring the foregoingaffine MVP list are as described later.

FIG. 13 illustratively represents an example of configuring an affineMVP list.

Referring to FIG. 13 , the encoding apparatus/decoding apparatus may addthe inherited candidate to the affine MVP list of the current block(S1300). The inherited candidate may represent the foregoing inheritedaffine candidate.

Specifically, the encoding apparatus/decoding apparatus may derive themaximum two inherited affine candidates from neighboring blocks of thecurrent block (S1305). Here, the neighboring blocks may include a leftneighboring block A0, a bottom-left corner neighboring block A1, a topneighboring block B0, a top-right corner neighboring block B1, and atop-left corner neighboring block B2 of the current block.

For example, the encoding apparatus/decoding apparatus may derive thefirst affine MVP candidate of the current block based on a first blockin the neighboring blocks. Here, the first block may be coded with theaffine motion model, and the reference picture of the first block may bethe same as the reference picture of the current block. That is, thefirst block may be a block which has been first confirmed to satisfy acondition while checking neighboring blocks in a specific order. Thecondition may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block.

Hereinafter, the encoding apparatus/decoding apparatus may derive asecond affine MVP candidate of the current block based on a second blockin the neighboring blocks. Here, the second block may be coded with theaffine motion model, and the reference picture of the second block maybe the same as the reference picture of the current block. That is, thesecond block may be a block which has been second confirmed to satisfy acondition while checking neighboring blocks in a specific order. Thecondition may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block.

Meanwhile, the specific order may be like this: the left neighboringblock A0→the bottom-left corner neighboring block A1→the top neighboringblock B0→the top-right corner neighboring block B1→the top-left cornerneighboring block B2. Further, it may be performed in an order otherthan the forgoing order, and may not be limited to the forgoing example.

The encoding apparatus/decoding apparatus may add the constructedcandidate to the affine MVP list of the current block (S1310). Theconstructed candidate may represent the foregoing constructed affinecandidate. The constructed candidate may be represented as theconstructed affine MVP candidate. When the number of the availableinherited candidates is less than two, the encoding apparatus/decodingapparatus may add the constructed candidate to the affine MVP list ofthe current block. For example, the encoding apparatus/decodingapparatus may derive one constructed affine candidate.

Meanwhile, the method of deriving the constructed affine candidate maybe different depending on whether the affine motion model applied to thecurrent block is 6-affine motion model or 4-affine motion model.Specific contents for the method of deriving the constructed candidatewill be described later.

The encoding apparatus/decoding apparatus may add the HEVC AMVPcandidate to the affine MVP list of the current block (S1320). When thenumber of the available inherited candidate and/or the constructedcandidate is less than two, the encoding apparatus/decoding apparatusmay add the HEVC AMVP candidate to the affine MVP list of the currentblock. That is, when the number of the available inherited candidateand/or the constructed candidate is less than two, the encodingapparatus and/or the decoding apparatus may perform the process toconfigure an MVP candidate in the conventional HEVC standard.

Meanwhile, a method of deriving the constructed candidate may be asfollows.

For example, when the affine motion model applied to the current blockis 6-affine motion model, the constructed candidate may be derived as inan example shown in FIG. 14 .

FIG. 14 represents an example of deriving the constructed candidate.

Referring to FIG. 14 , the encoding apparatus/decoding apparatus maycheck mv₀, mv₁, and mv₂ for the current block (S1400). That is, theencoding apparatus/decoding apparatus may determine whether availablemv₀, mv₁, or mv₂ exists in the neighboring blocks of the current block.Here, the mv₀ may be a CPMVP candidate of CP0 of the current block; themv₁, a CPMVP candidate of CP1; and the mv₂, a CPMVP candidate of CP2.Further, the mv₀, the mv₁, and the mv₂ may be represented to becandidate motion vectors of the CPs.

For example, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in a first group in a specific orderwhether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₀ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₀ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the first group in a specific order.When the motion vectors of the neighboring blocks in the first group donot satisfy the specific condition, there may be no available mv₀. Here,for example, the specific order may be one from the neighboring block Ato the neighboring block B, and then to the neighboring block C in thefirst group. Further, for example, the specific condition may be thatthe reference picture for the motion vector of the neighboring blockshould be the same as the reference picture of the current block.

Further, for example, the encoding apparatus/decoding apparatus maycheck motion vectors of the neighboring blocks in a second group in aspecific order whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₁ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₁ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the second group in a specific order.When the motion vectors of the neighboring blocks in the second group donot satisfy the specific condition, there may be no available mv₁. Here,for example, the specific order may be one from the neighboring block Dto the neighboring block E in the second group. Further, for example,the specific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

Further, for example, the encoding apparatus/decoding apparatus maycheck motion vectors of the neighboring blocks in a third group in aspecific order whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₂ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₂ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the third group in a specific order.When the motion vectors of the neighboring blocks in the third group donot satisfy the specific condition, there may be no available mv₂. Here,for example, the specific order may be one from the neighboring block Fto the neighboring block G in the third group. Further, for example, thespecific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

Meanwhile, the first group may include a motion vector of theneighboring block A, a motion vector of the neighboring block B, and amotion vector of the neighboring block C; the second group, a motionvector of the neighboring block D, and a motion vector of theneighboring block E; and the third group, a motion vector of theneighboring block F, and a motion vector of the neighboring block G. Theneighboring block A may represent a neighboring block located top leftof a top-left sample position of the current block; the neighboringblock B, a neighboring block located top of the top-left sample positionof the current block; the neighboring block C, a neighboring blocklocated left of the top-left sample position of the current block; theneighboring block D, a neighboring block located top of a top-rightsample position of the current block; the neighboring block E, aneighboring block located top right of the top-right sample position ofthe current block; the neighboring block F, a neighboring block locatedleft of the bottom-left sample position of the current block; and theneighboring block G, a neighboring block located bottom left of thebottom-left sample position of the current block.

When only the mv₀ and the mv₁ for the current block are available, thatis, when only the mv₀ and the mv₁ for the current block are derived, theencoding apparatus/decoding apparatus may derive mv₂ for the currentblock based on forgoing Equation 6 (S1410). The encodingapparatus/decoding apparatus may derive the mv₂ by substituting thederived mv₀ and the mv₁ in forgoing Equation 6.

When only the mv₀ and the mv₂ for the current block are available, thatis, when only the mv₀ and the mv₂ for the current block are derived, theencoding apparatus/decoding apparatus may derive mv₁ for the currentblock based on forgoing Equation 7 (S1420). The encodingapparatus/decoding apparatus may derive the mv₁ by substituting thederived mv₀ and the mv₂ in forgoing Equation 7.

The encoding apparatus/decoding apparatus may derive the derived mv₀,mv₁ and mv₂ as the constructed candidate of the current block (S1430).When the mv₀, the mv₁ and the mv₂ are available, that is, when the mv₀,the mv₁ and the mv₂ are derived based on the neighboring block of thecurrent block, the encoding apparatus/decoding apparatus may derive thederived mv₀, the mv₁ and the mv₂ as the constructed candidates of thecurrent block.

Further, when only the mv₀ and the mv₁ for the current block areavailable, that is, when only the mv₀ and the mv₁ for the current blockare derived, the encoding apparatus/decoding apparatus may derive as theconstructed candidate of the current block mv₀, the mv₁ and mv₂ derivedbased on forgoing Equation 6.

Further, when only the mv₀ and the mv₂ for the current block areavailable, that is, when only the mv₀ and the mv₂ for the current blockare derived, the encoding apparatus/decoding apparatus may derive as theconstructed candidate of the current block the derived mv₀, the mv₂, andmv₁ derived based on-forgoing Equation 7.

Further, for example, when the affine motion model applied to thecurrent block is 4-affine motion model, the constructed candidate may bederived as in an example shown in FIG. 15 .

FIG. 15 represents an example of deriving the constructed candidate.

Referring to FIG. 15 , the encoding apparatus/decoding apparatus maycheck mv₀, mv₁, and mv₂ for the current block (S1500). That is, theencoding apparatus/decoding apparatus may determine whether availablemv₀, mv₁, or mv₂ exists in the neighboring blocks of the current block.Here, the mv₀ may be a CPMVP candidate of CP0 of the current block; themv₁, a CPMVP candidate of CP1; and the mv₂, a CPMVP candidate of CP2.

For example, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in a first group in a specific orderwhether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₀ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₀ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the first group in a specific order.When the motion vectors of the neighboring blocks in the first group donot satisfy the specific condition, there may be no available mv₀. Here,for example, the specific order may be one from the neighboring block Ato the neighboring block B, and then to the neighboring block C in thefirst group. Further, for example, the specific condition may be thatthe reference picture for the motion vector of the neighboring blockshould be the same as the reference picture of the current block.

Further, for example, the encoding apparatus/decoding apparatus maycheck motion vectors of the neighboring blocks in a second group in aspecific order whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₁ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₁ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the second group in a specific order.When the motion vectors of the neighboring blocks in the second group donot satisfy the specific condition, there may be no available mv₁. Here,for example, the specific order may be one from the neighboring block Dto the neighboring block E in the second group. Further, for example,the specific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

Further, for example, the encoding apparatus/decoding apparatus maycheck motion vectors of the neighboring blocks in a third group in aspecific order whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₂ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₂ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the third group in a specific order.When the motion vectors of the neighboring blocks in the third group donot satisfy the specific condition, there may be no available mv₂. Here,for example, the specific order may be one from the neighboring block Fto the neighboring block G in the third group. Further, for example, thespecific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

Meanwhile, the first group may include a motion vector of theneighboring block A, a motion vector of the neighboring block B, and amotion vector of the neighboring block C; the second group, a motionvector of the neighboring block D, and a motion vector of theneighboring block E; and the third group, a motion vector of theneighboring block F, and a motion vector of the neighboring block G. Theneighboring block A may represent a neighboring block located top leftof a top-left sample position of the current block; the neighboringblock B, a neighboring block located top of the top-left sample positionof the current block; the neighboring block C, a neighboring blocklocated left of the top-left sample position of the current block; theneighboring block D, a neighboring block located top of a top-rightsample position of the current block; the neighboring block E, aneighboring block located top right of the top-right sample position ofthe current block; the neighboring block F, a neighboring block locatedleft of the bottom-left sample position of the current block; and theneighboring block G, a neighboring block located bottom left of thebottom-left sample position of the current block.

When only the mv₀ and the mv₁ for the current block are available orwhen the mv₀, the mv₁, and the mv₂ for the current block are available,that is, when only the mv₀ and the mv₁ for the current block are derivedor when the mv₀, the mv₁, and the mv₂ for the current block are derived,the encoding apparatus/decoding apparatus may derive the derived mv₀ andthe mv₁ as the constructed candidate of the current block (S1510).

Meanwhile, when only the mv₀ and the mv₂ for the current block areavailable, that is, when only the mv₀ and the mv₂ for the current blockare derived, the encoding apparatus/decoding apparatus may derive mv₁for the current block based on forgoing Equation 7 (S1520). The encodingapparatus/decoding apparatus may derive the mv₁ by substituting thederived mv₀ and the mv₂ in forgoing Equation 7.

After this, the encoding apparatus/decoding apparatus may derive thederived mv₀ and mv₁ as the constructed candidate of the current block(S1510).

Meanwhile, the present document proposes another example of deriving theinherited affine candidate. The proposed example can improve codingperformance by reducing computational complexity in deriving theinherited affine candidate.

Meanwhile, the present document proposes another example of deriving theinherited affine candidate. The proposed example can improve codingperformance by reducing computational complexity in deriving theinherited affine candidate.

FIG. 16 illustratively represents a neighboring block position which isscanned to derive the inherited affine candidate.

The encoding apparatus/decoding apparatus may derive the maximum twoinherited affine candidates from neighboring blocks of the currentblock. FIG. 16 may represent the neighboring blocks for the inheritedaffine candidates. For example, the neighboring blocks may include aneighboring block A and a neighboring block B shown in FIG. 16 . Theneighboring block A may represent the above-described left neighboringblock A0, and the neighboring block B may represent the above-describedtop neighboring block B0.

For example, the encoding apparatus/decoding apparatus may check theneighboring blocks in a specific order whether it is available, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. That is, theencoding apparatus/decoding apparatus may check the neighboring blocksin a specific order whether it satisfies a specific condition, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. Further, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. That is, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. Here, beingavailable may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block. That is, the specific condition may be that ablock is coded with the affine motion model, and that a referencepicture of a block is the same as a reference picture of the currentblock. Further, for example, the specific order may be the followingone: the neighboring block A→the neighboring block B. Meanwhile, apruning check process between two inherited affine candidates (i.e.,derived inherited affine candidates) may not be performed. The pruningcheck process may represent a process by which candidates are checkedwhether they are the same as each other, and, if they are the same, thecandidate derived at a later order is removed.

The foregoing example proposes a method of deriving the inherited affinecandidate by checking only two neighboring blocks (i.e., the neighboringblocks A, and B) instead of deriving the inherited affine candidate bychecking all the conventional neighboring blocks (i.e., the neighboringblocks A, B, C, D, and E). Here, the neighboring block C may representthe above-described top-right corner neighboring block B1; theneighboring block D, the above-described bottom-left corner neighboringblock A1; and the neighboring block E, the above-described top-leftcorner neighboring block B2.

In order to analyze spatial correlation between the neighboring blocksand the current block according to affine inter prediction, theprobability that the affine prediction is applied to the current blockwhen the affine prediction is applied to the respective neighboringblocks may be referenced. The probability that the affine prediction isapplied to the current block when the affine prediction is applied tothe respective neighboring blocks may be derived as the following table.

TABLE 2 REFERENCE BLOCK A B C D E PROBABILITY 65% 41% 5% 3% 1%

Referring to Table 2, it can be confirmed that the spatial correlationsof the neighboring blocks A and B among the neighboring blocks to thecurrent block are high. Therefore, through an example of deriving theinherited affine candidate using only the neighboring blocks A and Bwhose spatial correlations are high, it is possible to achieveadvantageous effects of reducing the processing time and providing highdecoding performance.

Meanwhile, the pruning check process may be performed to prevent thesame candidates from existing in the candidate list. As the pruningcheck process may remove redundancy, there may be a merit in terms ofencoding efficiency, and however, there is a drawback that thecomputational complexity increases by performing the pruning checkprocess. Particularly, as the pruning check process for the affinecandidate should be performed on the affine type (e.g., the affinemotion model is 4-affine motion model or 6-affine motion model), thereference picture (or reference picture index), CP0, CP1 and CP2 of MV,the computational complexity is very high. Therefore, the presentexample proposes a method of not performing the pruning check processbetween the inherited affine candidate (e.g., inherited_A) derived basedon the neighboring block A and the inherited affine candidate (e.g.,inherited_B) derived based on the neighboring block B. The neighboringblocks A and B are far in distance, and thus their spatial correlationis low. Therefore, the probability that the inherited_A and theinherited_B are the same is very low. Accordingly, it is appropriatethat the pruning check process between the inherited affine candidatesis not performed.

Alternatively, a method of performing a minimal pruning check processmay be proposed based on the above. For example, the encodingapparatus/decoding apparatus may perform the pruning check process bycomparing MVs of CP0 of the inherited affine candidate.

Meanwhile, the present document proposes another example of deriving theinherited affine candidate.

FIG. 17 illustratively represents a neighboring block position which isscanned to derive the inherited affine candidate.

The encoding apparatus/decoding apparatus may derive the maximum twoinherited affine candidates from neighboring blocks of the currentblock. FIG. 17 may represent the neighboring blocks for the inheritedaffine candidates. For example, the neighboring blocks may include aneighboring block A to a neighboring block D shown in FIG. 17 . Theneighboring block A may represent the above-described left neighboringblock A0; the neighboring block B, the above-described top neighboringblock B0; the neighboring block C, the above-described top-right cornerneighboring block B1; and the neighboring block D, the above-describedbottom-left corner neighboring block A1.

For example, the encoding apparatus/decoding apparatus may check theneighboring blocks in a specific order whether it is available, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. That is, theencoding apparatus/decoding apparatus may check the neighboring blocksin a specific order whether it satisfies a specific condition, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. Further, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. That is, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. Here, beingavailable may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block. That is, the specific condition may be that ablock is coded with the affine motion model, and that a referencepicture of a block is the same as a reference picture of the currentblock.

The neighboring blocks A and D of FIG. 17 may be used when deriving aleft predictor among the inherited affine candidate, and the neighboringblocks B and C may be used when deriving a top predictor among theinherited affine candidate.

The left predictor, that is the motion candidate which may be added fromthe left neighboring block, may be added to a candidate to which“neighboring significant block” that is first determined to be availablein block A→block D or block D→block A order is inherited. The toppredictor, that is the motion candidate which may be added from the topneighboring block, may be added to a candidate to which “neighboringsignificant block” that is first determined to be available in blockB→block C or block C→block B order is inherited. That is, the maximumnumber of the inherited candidate which may be derived from each of theleft predictor and the top predictor is one.

When the “neighboring significant block” is coded with 4-parameteraffine motion model, the inherited candidate may be determined using4-parameter affine motion model, and when the “neighboring significantblock” is coded with 6-parameter affine motion model, the inheritedcandidate may be determined using 6-parameter affine motion model.

When the number of the inherited candidates determined by the leftpredictor and the top predictor is two, the pruning check process may beperformed or not be performed. Although it is general to perform thepruning check process and prevent the same candidate from being addedinto the candidate list, the pruning check process increases complexitybecause MV of each CP should be compared in motion prediction in whichthe affine model is used. However, when the inherited candidate isconfigured using the example described with reference to FIG. 17 , theprobability that the candidates determined by the left predictor and thetop predictor are different from each other is very high because thecandidates are far in distance. Therefore, there is an advantage that,even without performing the pruning check process, the codingperformance rarely decreases.

Meanwhile, the present document proposes still another example ofderiving the inherited affine candidate.

FIG. 18 illustratively represents a position for deriving the inheritedaffine candidate.

The encoding apparatus/decoding apparatus may derive the maximum twoinherited affine candidates from neighboring blocks of the currentblock. FIG. 18 may represent the neighboring blocks for the inheritedaffine candidates according to the example. For example, the neighboringblocks may include a neighboring block A to a neighboring block E shownin FIG. 18 . The neighboring block A may represent the above-describedleft neighboring block A0; the neighboring block B, the above-describedtop neighboring block B0; the neighboring block C, the above-describedtop-right corner neighboring block B1; the neighboring block D, theabove-described bottom-left corner neighboring block A1; and theneighboring block E, a left neighboring block located adjacent to thebottom of the top-left corner neighboring block B2.

For example, the encoding apparatus/decoding apparatus may check theneighboring blocks in a specific order whether it is available, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. That is, theencoding apparatus/decoding apparatus may check the neighboring blocksin a specific order whether it satisfies a specific condition, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. Further, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. That is, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. Here, beingavailable may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block. That is, the specific condition may be that ablock is coded with the affine motion model, and that a referencepicture of a block is the same as a reference picture of the currentblock.

The neighboring blocks A, D and E of FIG. 18 may be used when deriving aleft predictor among the inherited affine candidate, and the neighboringblocks B and C may be used when deriving a top predictor among theinherited affine candidate.

The left predictor, that is the motion candidate which may be added atthe left neighboring block, may be added to a candidate to which“neighboring significant block” that is first determined to be availablein block A→block E→block D (or block A→block E→block D, block D→blockA→block E) order is inherited. The top predictor, that is the motioncandidate which may be added at the top neighboring block, may be addedto a candidate to which “neighboring significant block” that is firstdetermined to be available in block B→block C or block C→block B orderis inherited. That is, the maximum number of the inherited candidatewhich may be derived from each of the left predictor and the toppredictor is one.

When the “neighboring significant block” is coded with 4-parameteraffine motion model, the inherited candidate may be determined using4-parameter affine motion model, and when the “neighboring significantblock” is coded with 6-parameter affine motion model, the inheritedcandidate may be determined using 6-parameter affine motion model.

When the number of the inherited candidates determined by the leftpredictor and the top predictor is two, the pruning check process may beperformed or not be performed. Although it is general to perform thepruning check process and prevent the same candidate from being addedinto the candidate list, the pruning check process increases complexitybecause MV of each CP should be compared in motion prediction in whichthe affine model is used. However, when the inherited candidate isconfigured using the example described with reference to FIG. 18 , theprobability that the candidates determined by the left predictor and thetop predictor are different from each other is very high because thecandidates are far in distance. Therefore, there is an advantage that,even without performing the pruning check process, the codingperformance rarely decreases.

Meanwhile, a pruning check method whose complexity is low may be usedinstead of performing the pruning check process. For example, thepruning check process may be performed with a method of comparing onlyMV of CP0.

The reason that E is determined to be at a position of a neighboringblock to be scanned for the inherited candidate is as follows. In a linebuffer reduction method to be described later, when the reference block(i.e., the neighboring block B, the neighboring block C) located abovethe current block does not exist in the same CTU as the current block,the line buffer reduction method may not be used. Therefore, when theline buffer reduction method is applied together while generating theinherited candidate, the position of the neighboring block expressed inFIG. 18 is used to maintain the coding performance.

Further, the method may configure maximum one inherited candidate anduse it as the affine MVP candidate. At this time, the motion vector ofthe neighboring block which is first significant based on an order ofA→B→C→D without distinction of the left predictor and the top predictormay be used as the inherited candidate.

Meanwhile, the present document proposes still another example ofderiving the inherited affine candidate.

In the present example, the inherited candidate may be derived using theneighboring block shown in FIG. 18 .

That is, the encoding apparatus/decoding apparatus may derive themaximum two inherited affine candidates from neighboring blocks of thecurrent block.

Further, the encoding apparatus/decoding apparatus may check theneighboring blocks in a specific order whether it is available, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. That is, theencoding apparatus/decoding apparatus may check the neighboring blocksin a specific order whether it satisfies a specific condition, andderive the inherited affine candidate of the current block based on theneighboring block which is first confirmed to be available. Further, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. That is, theencoding apparatus/decoding apparatus may derive the inherited affinecandidate of the current block based on the neighboring block which issecond confirmed to satisfy the specific condition. Here, beingavailable may be that a block is coded with the affine motion model, andthat a reference picture of a block is the same as a reference pictureof the current block. That is, the specific condition may be that ablock is coded with the affine motion model, and that a referencepicture of a block is the same as a reference picture of the currentblock.

As described above, the neighboring blocks A, D and E may be used whenderiving a left predictor among the inherited affine candidate, and theneighboring blocks B and C may be used when deriving a top predictoramong the inherited affine candidate.

The left predictor, that is the motion candidate which may be added atthe left neighboring block, may be added to a candidate to which“neighboring significant block” that is first determined to be availablein block A→block E→block D (or block A→block E→block D, block D→blockA→block E) order is inherited. The top predictor, that is the motioncandidate which may be added at the top neighboring block, may be addedto a candidate to which “neighboring significant block” that is firstdetermined to be available in block B→block C or block C→block B orderis inherited. That is, the maximum number of the inherited candidatewhich may be derived from each of the left predictor and the toppredictor is one.

When the “neighboring significant block” is coded with 4-parameteraffine motion model, the inherited candidate may be determined using4-parameter affine motion model, and when the “neighboring significantblock” is coded with 6-parameter affine motion model, the inheritedcandidate may be determined using 6-parameter affine motion model.

Further, according to even the present example, when the number of theinherited candidates determined by the left predictor and the toppredictor is two, the pruning check process may be performed or not beperformed. Although it is general to perform the pruning check processand prevent the same candidate from being added into the candidate list,the pruning check process increases complexity because MV of each CPshould be compared in motion prediction in which the affine model isused. However, when the inherited candidate is configured using theexample described with reference to FIG. 18 , the probability that thecandidates determined by the left predictor and the top predictor aredifferent from each other is very high because the candidates are far indistance. Therefore, there is an advantage that, even without performingthe pruning check process, the coding performance rarely decreases.

Meanwhile, a pruning check method whose complexity is low may be usedinstead of performing the pruning check process. For example, thepruning check process may be performed determining whether theneighboring block E is included in the same coding block as theneighboring block A only when the neighboring block E is a “neighboringsignificant block”. The complexity is low because it performs thepruning check only one time. The reason that the pruning check isperformed only on the neighboring block E is that the probability thatthe reference block (the neighboring block B, the neighboring block C)of the top predictor except the neighboring block E, and the referenceblock (the neighboring block A, the neighboring block D) of the leftpredictor configure the same inherited candidate is very low becausethey are located enough far from each other, and because contrarily, inthe case of the neighboring block E, the probability that it configuresthe same inherited candidate exists when it is included in the sameblock as the neighboring block A.

The reason that E is determined as a position of a neighboring block tobe scanned for the inherited candidate is as follows. In a line bufferreduction method to be described later, when the reference block (i.e.,the neighboring block B, the neighboring block C) located above thecurrent block does not exist in the same CTU as the current block, theline buffer reduction method may not be used. Therefore, when the linebuffer reduction method is applied together while generating theinherited candidate, the position of the neighboring block expressed inFIG. 18 is used to maintain the coding performance.

Further, the method may configure maximum one inherited candidate anduse it as the affine MVP candidate. At this time, the motion vector ofthe neighboring block which is first significant based on an order ofA→B→C→D without distinction of the left predictor and the top predictormay be used as the inherited candidate.

Meanwhile, according to an example of the present document, thegeneration method of the affine MVP list described with reference toFIGS. 16 to 18 may be applied to a method of deriving the inheritedcandidate of the merge candidate list based on the affine motion model.According to the present example, there is an advantage in terms ofdesign cost because the same process can be applied to the affine MVPlist generation and the merge candidate list generation. An example ofgenerating the merge candidate list based on the affine motion model isas follows, and this process may be applied to configure the inheritedcandidate when generating other merge list.

Specifically, the merge candidate list may be configured as below.

FIG. 19 represents an example of configuring the merge candidate list ofthe current block.

Referring to FIG. 19 , the encoding apparatus/decoding apparatus may addthe inherited merge candidate to the merge candidate list (S1900).

Specifically, the encoding apparatus/decoding apparatus may derive theinherited candidate based on the neighboring blocks of the currentblock.

Neighboring blocks of the current block for deriving the inheritedcandidate are as in FIG. 11 . That is, the neighboring blocks of thecurrent block may include a bottom-left corner neighboring block A0 ofthe current block, a left neighboring block A1 of the current block, antop-right corner neighboring block B0 of the current block, an topneighboring block B1 of the current block, and a top-left cornerneighboring block B2 of the current block.

The inherited candidate may be derived based on a significantneighboring reconstructed block which has been coded in the affine mode.For example, the encoding apparatus/decoding apparatus may check theneighboring blocks A0, A1, B0, B1 and B2 sequentially, or neighboringblocks A1, B1 B0, A0 and B2 sequentially, and, if the neighboring blockhas been coded in the affine mode (that is, if the neighboring block isa neighboring block which has been significantly reconstructed by usingthe affine motion model), may derive two CPMVs or three CPMVs for thecurrent block based on the affine motion model of the neighboring block,and the CPMVs may be derived as the inherited candidate of the currentblock. As one example, maximum five inherited candidates may be addedinto the merge candidate list. That is, the maximum five inheritedcandidates may be derived based on the neighboring blocks.

When following the present example, in order to derive the inheritedcandidate, not the neighboring block of FIG. 11 but the neighboringblock of FIGS. 16 to 18 may be used and the example described withreference to FIGS. 16 to 18 may be applied.

After this, the encoding apparatus/decoding apparatus may add aconstructed candidate into the merge candidate list (S1910).

For example, if the number of merge candidates of the merge candidatelist is less than five, the constructed candidate may be added into themerge candidate list. The constructed candidate may represent a mergecandidate which is generated by combining neighboring motion informationon each of CPs of the current block (i.e., motion vector of theneighboring block and reference picture index). The motion informationon each of CPs may be derived based on a spatial neighboring block or atemporal neighboring block for the corresponding CP. The motioninformation on each of the CPs may be represented as a candidate motionvector for the corresponding CP.

FIG. 20 represents neighboring blocks of the current block for derivinga constructed candidate according to an example of the present document.

Referring to FIG. 20 , the neighboring blocks may include spatialneighboring blocks and a temporal neighboring block. The spatialneighboring blocks may include a neighboring block A0, a neighboringblock A1, a neighboring block A2, a neighboring block B0, a neighboringblock B1, a neighboring block B2, and a neighboring block B3. Aneighboring block T shown in FIG. 20 may represent the temporalneighboring block.

Here, the neighboring block B2 may represent a neighboring block locatedtop left of a top-left sample position of the current block; theneighboring block B3, a neighboring block located top of the top-leftsample position of the current block; and the neighboring block A2, aneighboring block located left of the top-left sample position of thecurrent block. In addition, the neighboring block B1 may represent aneighboring block located top of the top-right sample position of thecurrent block; and the neighboring block B0, a neighboring block locatedtop right of the top-right sample position of the current block. Inaddition, the neighboring block A1 may represent a neighboring blocklocated left of the bottom-left sample position of the current block;and the neighboring block A0, a neighboring block located bottom left ofthe bottom-left sample position of the current block.

Further, referring to FIG. 20 , the CPs of the current block may includeCP0, CP1, CP2 and/or CP3. The CP0 may represent a top-left position ofthe current block; the CP1, a top-right position of the current block;the CP2, a bottom-left position of the current block; and the CP3, abottom-right position of the current block. For example, if a size ofthe current block is W×H, and x component of the top-left sampleposition of the current block is 0 and y component thereof is 0, the CP0may represent a position at coordinates (0, 0); the CP1, a position atcoordinates (W, 0); the CP2, a position at coordinates (0, H); and theCP3, a position at coordinates (W, H).

A motion vector for each of the forgoing CPs may be derived as below.

For example, the encoding apparatus/decoding apparatus may checkneighboring blocks in a first group in a first order whether it isavailable, and may derive as a candidate motion vector for the CP0 amotion vector of the neighboring block which is first confirmed to beavailable during the check process. That is, the candidate motion vectorfor the CP0 may be a motion vector of the neighboring block which isfirst confirmed to be available while checking neighboring blocks in thefirst group in the first order. The being available may representexistence of a motion vector of the neighboring block. That is, theavailable neighboring block may be a block which has been coded in interprediction (that is, a block to which the inter prediction has beenapplied). Here, for example, the first group may include the neighboringblock B2, the neighboring block B3 and the neighboring block A2. Thefirst order may be an order in the first group from the neighboringblock B2 to the neighboring block B3, and then to the neighboring blockA2. As one example, if the neighboring block B2 is available, the motionvector of the neighboring block B2 may be derived as the candidatemotion vector for the CP0; if the neighboring block B2 is not availableand the neighboring block B3 is available, the motion vector of theneighboring block B3, as the candidate motion vector for the CP0; and ifnone of the neighboring blocks B2 and B3 is available and theneighboring block A2 is available, the motion vector of the neighboringblock A2, as the candidate motion vector for the CP0.

Further, for example, the encoding apparatus/decoding apparatus maycheck neighboring blocks in a second group in a second order whether itis available, and may derive as a candidate motion vector for the CP1 amotion vector of the neighboring block which is first confirmed to beavailable during the check process. That is, the candidate motion vectorfor the CP1 may be a motion vector of the neighboring block which isfirst confirmed to be available while checking neighboring blocks in thesecond group in the second order. The being available may representexistence of a motion vector of the neighboring block. That is, theavailable neighboring block may be a block which has been coded in interprediction (that is, a block to which the inter prediction has beenapplied). Here, the second group may include the neighboring block B1and the neighboring block B0. The second order may be an order in thesecond group from the neighboring block B1 to the neighboring block B0.As one example, if the neighboring block B1 is available, the motionvector of the neighboring block B1 may be derived as the candidatemotion vector for the CP1; and if the neighboring block B1 is notavailable and the neighboring block B0 is available, the motion vectorof the neighboring block B0, as the candidate motion vector for the CP1.

Further, for example, the encoding apparatus/decoding apparatus maycheck neighboring blocks in a third group along a third order whether itis available, and may derive as a candidate motion vector for the CP2 amotion vector of the neighboring block which is first confirmed to beavailable during the check process. That is, the candidate motion vectorfor the CP2 may be a motion vector of the neighboring block which isfirst confirmed to be available while checking neighboring blocks in thethird group in the third order. The being available may representexistence of a motion vector of the neighboring block. That is, theavailable neighboring block may be a block which has been coded in interprediction (that is, a block to which the inter prediction has beenapplied). Here, the third group may include the neighboring block A1 andthe neighboring block A0. The third order may be an order in the thirdgroup from the neighboring block A1 to the neighboring block A0. As oneexample, if the neighboring block A1 is available, the motion vector ofthe neighboring block A1 may be derived as the candidate motion vectorfor the CP2; and if the neighboring block A1 is not available and theneighboring block A0 is available, the motion vector of the neighboringblock A0, as the candidate motion vector for the CP2.

Further, for example, the encoding apparatus/decoding apparatus maycheck the temporal neighboring block (i.e., the neighboring block T)whether it is available, and if the temporal neighboring block (i.e.,the neighboring block T) is available, a motion vector of the temporalneighboring block (i.e., the neighboring block T) may be derived as acandidate motion vector for the CP3.

Combination of the candidate motion vector for the CP0, the candidatemotion vector for the CP1, the candidate motion vector for the CP2,and/or the candidate motion vector for the CP3 may be derived as aconstructed candidate.

For example, as described above, the 6-affine model needs motion vectorsof three CPs. For the 6-affine model, three CPs may be selected fromamong the CP0, the CP1, the CP2 and the CP3. For example, the CPs may beselected as one of {CP0, CP1, CP3}, {CP0, CP1, CP2}, {CP1, CP2, CP3} and{CP0, CP2, CP3}. As one example, the 6-affine model may be configured byusing CP0, CP1 and CP2. In this case, the CPs may be represented as the{CP0, CP1, CP2}.

Further, for example, as described above, the 4-affine model needsmotion vectors of two CPs. For the 4-affine model, two CPs may beselected from among the CP0, the CP1, the CP2 and the CP3. For example,the CPs may be selected as one of {CP0, CP3}, {CP1, CP2}, {CP0, CP1},{CP1, CP3}, {CP0, CP2} and {CP2, CP3}. As one example, the 4-affinemodel may be constituted by using CP0 and CP1. In this case, the CPs maybe represented as the {CP0, CP1}.

The constructed candidate, which is combinations of candidate motionvectors, may be added into the merge candidate list in the followingorder. That is, after candidate motion vectors for the CPs have beenderived, the constructed candidate may be derived in the followingorder:

{CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP1, CP2, CP3},{CP0, CP1}, {CP0, CP2}, {CP1, CP2}, {CP0, CP3}, {CP1, CP3}, {CP2, CP3}

That is, for example, a constructed candidate including a candidatemotion vector for the CP0, a candidate motion vector for the CP1 and acandidate motion vector for the CP2, a constructed candidate including acandidate motion vector for the CP0, a candidate motion vector for theCP1 and a candidate motion vector for the CP3, a constructed candidateincluding a candidate motion vector for the CP0, a candidate motionvector for the CP2 and a candidate motion vector for the CP3, aconstructed candidate including a candidate motion vector for the CP1, acandidate motion vector for the CP2 and a candidate motion vector forthe CP3, a constructed candidate including a candidate motion vector forthe CP0 and a candidate motion vector for the CP1, a constructedcandidate including a candidate motion vector for the CP0 and acandidate motion vector for the CP1, a constructed candidate including acandidate motion vector for the CP0 and a candidate motion vector forthe CP2, a constructed candidate including a candidate motion vector forthe CP1 and a candidate motion vector for the CP2, a constructedcandidate including a candidate motion vector for the CP0 and acandidate motion vector for the CP3, a constructed candidate including acandidate motion vector for the CP1 and a candidate motion vector forthe CP3, and a constructed candidate including a candidate motion vectorfor the CP2 and a candidate motion vector for the CP3 may be added intothe merge candidate list in this order.

After this, the encoding apparatus/decoding apparatus may add a zeromotion vectors to the merge candidate list (S1920).

For example, if the number of merge candidates of the merge candidatelist is less than 5, a merge candidate including zero motion vectors maybe added into the merge candidate list until the merge candidate list isconfigured with the maximum number of merge candidates. The maximumnumber of the merge candidates may be five. Further, the zero motionvector may represent a motion vector whose vector value is zero.

Meanwhile, the scanning method for configuring the candidate and theposition of the neighboring blocks used in the generation method of theaffine MVP list described with reference FIGS. 16 to 18 may be used to anormal merge and a normal MVP. Here, the normal merge may mean a mergemode which is not the affine merge mode and may be used in the HEVC orthe like, and the normal MVP also may mean an AMVP which is not theaffine MVP and may be used in the HEVC. For example, applying the methoddescribed with reference to FIG. 16 to the normal merge and/or thenormal MVP specifically means scanning the neighboring block of thespatial position of FIG. 16 , and/or configuring the left predictor andthe top predictor using the neighboring block of FIG. 16 , and/orperforming the pruning check or performing with a method of lowcomplexity. When this method is applied to the normal merge or thenormal MVP, there may be an advantageous effect in terms of design cost.

Further, the present document proposes a method of deriving theconstructed candidate, which is different from the above-describedexample. The proposed example can improve the coding performance byreducing the complexity when compared with the described-above exampleof deriving a constructed candidate. The proposed example is asdescribed later. Further, when the number of the available inheritedaffine candidates is less than two (that is, the number of derivedinherited affine candidates is less than two), the constructed affinecandidate may be considered.

For example, the encoding apparatus/decoding apparatus may check mv₀,mv₁, and mv₂ for the current block. That is, the encodingapparatus/decoding apparatus may determine whether available mv₀, mv₁,or mv₂ exists in the neighboring blocks of the current block. Here, themv₀ may be a CPMVP candidate of CP0 of the current block; the mv₁, aCPMVP candidate of CP1; and the mv₂, a CPMVP candidate of CP2.

Specifically, the neighboring blocks of the current block may be dividedinto three groups, and the neighboring blocks may include a neighboringblock A, a neighboring block B, a neighboring block C, a neighboringblock D, a neighboring block E, a neighboring block F, and a neighboringblock G. The first group may include a motion vector of the neighboringblock A, a motion vector of the neighboring block B, and a motion vectorof the neighboring block C; the second group, a motion vector of theneighboring block D, and a motion vector of the neighboring block E; andthe third group, a motion vector of the neighboring block F, and amotion vector of the neighboring block G. The neighboring block A mayrepresent a neighboring block located top left of a top-left sampleposition of the current block; the neighboring block B, a neighboringblock located top of the top-left sample position of the current block;the neighboring block C, a neighboring block located left of thetop-left sample position of the current block; the neighboring block D,a neighboring block located top of a top-right sample position of thecurrent block; the neighboring block E, a neighboring block located topright of the top-right sample position of the current block; theneighboring block F, a neighboring block located left of the bottom-leftsample position of the current block; and the neighboring block G, aneighboring block located bottom left of the bottom-left sample positionof the current block.

The encoding apparatus/decoding apparatus may determine whetheravailable mv₀ exists in the first group, may determine whether availablemv₁ exists in the second group, and may determine whether available mv₂exists in the third group.

Specifically, for example, the encoding apparatus/decoding apparatus maycheck motion vectors of the neighboring blocks in the first group in aspecific order whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₀ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₀ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the first group in a specific order.When the motion vectors of the neighboring blocks in the first group donot satisfy the specific condition, there may be no available mv₀. Here,for example, the specific order may be one from the neighboring block Ato the neighboring block B, and then to the neighboring block C in thefirst group. Further, for example, the specific condition may be thatthe reference picture for the motion vector of the neighboring blockshould be the same as the reference picture of the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the second group in a specificorder whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₁ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₁ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the second group in a specific order.When the motion vectors of the neighboring blocks in the second group donot satisfy the specific condition, there may be no available mv₁. Here,for example, the specific order may be one from the neighboring block Dto the neighboring block E in the second group. Further, for example,the specific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the third group in a specific orderwhether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₂ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₂ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the third group in a specific order.When the motion vectors of the neighboring blocks in the third group donot satisfy the specific condition, there may be no available mv₂. Here,for example, the specific order may be one from the neighboring block Fto the neighboring block G in the third group. Further, for example, thespecific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

After this, when the affine motion model applied to the current block is4-affine motion model, and when mv₀ and mv₁ for the current block areavailable, the encoding apparatus/decoding apparatus may derive thederived mv₀ and mv₁ as the constructed candidate of the current block.Meanwhile, when mv₀ and/or mv₁ for the current block are/is notavailable, that is, when at least one of mv₀ and mv₁ is not derived fromthe neighboring block of the current block, the encodingapparatus/decoding apparatus may not add the constructed candidate tothe affine MVP list of the current block.

Further, when the affine motion model applied to the current block is6-affine motion model, and when mv₀, mv₁ and mv₂ for the current blockare available, the encoding apparatus/decoding apparatus may derive thederived mv₀, mv₁ and mv₂ as the constructed candidate of the currentblock. Meanwhile, when mv₀, mv₁ and/or mv₂ for the current block are/isnot available, that is, when at least one of mv₀, mv₁ and mv₂ is notderived from the neighboring block of the current block, the encodingapparatus/decoding apparatus may not add the constructed candidate tothe affine MVP list of the current block.

The above-described proposed example is a method which considers as theconstructed candidate only when all the motion vectors of CPs forgenerating an affine motion model of the current block are available.Here, the meaning of being available may represent that the referencepicture of the neighboring block is the same as the reference picture ofthe current block. That is, the constructed candidate may be derivedonly when among motion vectors of the neighboring blocks for therespective CPs of the current block, there exists the motion vectorsatisfying the condition. Therefore, when the affine motion modelapplied to the current block is 4-affine motion model, and only when MVsof CP0 and CP1 of the current block (that is, the mv₀ and the mv₁) areavailable, the constructed candidate may be considered. Therefore, whenthe affine motion model applied to the current block is the 6-affinemotion model, and only when MVs of CP0, CP1, and CP2 of the currentblock (that is, the mv₀, the mv₁, and the mv₂) are available, theconstructed candidate may be considered. Therefore, according to theproposed example, there may be no need for the additional configurationof deriving the motion vector for the CP based on Equation 6 or 7.Through this, it is possible to reduce the computational complexity forderiving the constructed candidate. Further, since the constructedcandidate is determined only when the CPMVP candidate having the samereference picture is available, it is possible to improve the overallcoding performance.

Meanwhile, a pruning check process between the derived inherited affinecandidate and the constructed affine candidate may not be performed. Thepruning check process may represent a process by which candidates arechecked whether they are the same as each other, and, if they are thesame, the candidate derived at a later order is removed.

The above-described example may be represented as in FIGS. 21 and 22 .

FIG. 21 represents an example of deriving the constructed candidate fora 4-affine motion model being applied to the current block.

Referring to FIG. 21 , the encoding apparatus/decoding apparatus maydetermine whether mv₀ and mv₁ for the current block are available(S2100). That is, the encoding apparatus/decoding apparatus maydetermine whether available mv₀ and mv₁ exist in the neighboring blocksof the current block. Here, the mv₀ may be a CPMVP candidate of CP0 ofthe current block, and the mv₁ may be a CPMVP candidate of CP1.

The encoding apparatus/decoding apparatus may determine whetheravailable mv₀ exists in the first group, and may determine whetheravailable mv₁ exists in the second group.

Specifically, the neighboring blocks of the current block may be dividedinto three groups, and the neighboring blocks may include a neighboringblock A, a neighboring block B, a neighboring block C, a neighboringblock D, a neighboring block E, a neighboring block F, and a neighboringblock G. The first group may include a motion vector of the neighboringblock A, a motion vector of the neighboring block B, and a motion vectorof the neighboring block C; the second group, a motion vector of theneighboring block D, and a motion vector of the neighboring block E; andthe third group, a motion vector of the neighboring block F, and amotion vector of the neighboring block G. The neighboring block A mayrepresent a neighboring block located top left of a top-left sampleposition of the current block; the neighboring block B, a neighboringblock located top of the top-left sample position of the current block;the neighboring block C, a neighboring block located left of thetop-left sample position of the current block; the neighboring block D,a neighboring block located top of a top-right sample position of thecurrent block; the neighboring block E, a neighboring block located topright of the top-right sample position of the current block; theneighboring block F, a neighboring block located left of the bottom-leftsample position of the current block; and the neighboring block G, aneighboring block located bottom left of the bottom-left sample positionof the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the first group in a specific orderwhether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₀ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₀ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the first group in a specific order.When the motion vectors of the neighboring blocks in the first group donot satisfy the specific condition, there may be no available mv₀. Here,for example, the specific order may be one from the neighboring block Ato the neighboring block B, and then to the neighboring block C in thefirst group. Further, for example, the specific condition may be thatthe reference picture for the motion vector of the neighboring blockshould be the same as the reference picture of the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the second group in a specificorder whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₁ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₁ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the second group in a specific order.When the motion vectors of the neighboring blocks in the second group donot satisfy the specific condition, there may be no available mv₁. Here,for example, the specific order may be one from the neighboring block Dto the neighboring block E in the second group. Further, for example,the specific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

When the mv₀ and the mv₁ for the current block are available, that is,when the mv₀ and the mv₁ for the current block are derived, the encodingapparatus/decoding apparatus may derive as the constructed candidate ofthe current block the derived mv₀ and mv₁ (S2110). Meanwhile, when mv₀and/or mv₁ for the current block are/is not available, that is, when atleast one of mv₀ and mv₁ is not derived from the neighboring block ofthe current block, the encoding apparatus/decoding apparatus may not addthe constructed candidate to the affine MVP list of the current block.

Meanwhile, a pruning check process between the derived inherited affinecandidate and the constructed affine candidate may not be performed. Thepruning check process may represent a process by which candidates arechecked whether they are the same as each other, and, if they are thesame, the candidate derived at a later order is removed.

FIG. 22 represents an example of deriving the constructed candidate fora 6-affine motion model being applied to the current block.

Referring to FIG. 22 , the encoding apparatus/decoding apparatus maydetermine whether mv₀, mv₁ and mv₂ for the current block are available(S2200). That is, the encoding apparatus/decoding apparatus maydetermine whether available mv₀, mv₁, or mv₂ exists in the neighboringblocks of the current block. Here, the mv₀ may be a CPMVP candidate ofCP0 of the current block; the mv₁, a CPMVP candidate of CP1; and themv₂, a CPMVP candidate of CP2.

The encoding apparatus/decoding apparatus may determine whetheravailable mv₀ exists in the first group, may determine whether availablemv₁ exists in the second group, and may determine whether available mv₂exists in the third group.

Specifically, the neighboring blocks of the current block may be dividedinto three groups, and the neighboring blocks may include a neighboringblock A, a neighboring block B, a neighboring block C, a neighboringblock D, a neighboring block E, a neighboring block F, and a neighboringblock G. The first group may include a motion vector of the neighboringblock A, a motion vector of the neighboring block B, and a motion vectorof the neighboring block C; the second group, a motion vector of theneighboring block D, and a motion vector of the neighboring block E; andthe third group, a motion vector of the neighboring block F, and amotion vector of the neighboring block G. The neighboring block A mayrepresent a neighboring block located top left of a top-left sampleposition of the current block; the neighboring block B, a neighboringblock located top of the top-left sample position of the current block;the neighboring block C, a neighboring block located left of thetop-left sample position of the current block; the neighboring block D,a neighboring block located top of a top-right sample position of thecurrent block; the neighboring block E, a neighboring block located topright of the top-right sample position of the current block; theneighboring block F, a neighboring block located left of the bottom-leftsample position of the current block; and the neighboring block G, aneighboring block located bottom left of the bottom-left sample positionof the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the first group in a specific orderwhether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₀ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₀ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the first group in a specific order.When the motion vectors of the neighboring blocks in the first group donot satisfy the specific condition, there may be no available mv₀. Here,for example, the specific order may be one from the neighboring block Ato the neighboring block B, and then to the neighboring block C in thefirst group. Further, for example, the specific condition may be thatthe reference picture for the motion vector of the neighboring blockshould be the same as the reference picture of the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the second group in a specificorder whether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₁ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₁ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the second group in a specific order.When the motion vectors of the neighboring blocks in the second group donot satisfy the specific condition, there may be no available mv₁. Here,for example, the specific order may be one from the neighboring block Dto the neighboring block E in the second group. Further, for example,the specific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

Further, the encoding apparatus/decoding apparatus may check motionvectors of the neighboring blocks in the third group in a specific orderwhether it satisfies a specific condition. The encodingapparatus/decoding apparatus may derive as the mv₂ the motion vector ofthe neighboring block which has been first confirmed to satisfy thecondition during the check process. That is, the mv₂ may be a motionvector which has been first confirmed to satisfy the specific conditionwhile checking motion vectors in the third group in a specific order.When the motion vectors of the neighboring blocks in the third group donot satisfy the specific condition, there may be no available mv₂. Here,for example, the specific order may be one from the neighboring block Fto the neighboring block G in the third group. Further, for example, thespecific condition may be that the reference picture for the motionvector of the neighboring block should be the same as the referencepicture of the current block.

When the mv₀, the mv₁, and the mv₂ for the current block are available,that is, when the mv₀, the mv₁, and the mv₂ for the current block arederived, the encoding apparatus/decoding apparatus may derive as theconstructed candidate of the current block the derived mv₀, mv₁, and mv₂(S2210). Meanwhile, when mv₀, mv₁ and/or mv₂ for the current blockare/is not available, that is, when at least one of mv₀, mv₁ and mv₂ isnot derived from the neighboring block of the current block, theencoding apparatus/decoding apparatus may not add the constructedcandidate to the affine MVP list of the current block.

Meanwhile, a pruning check process between the derived inherited affinecandidate and the constructed affine candidate may not be performed.

Meanwhile, when the number of the derived affine candidate is less thantwo (that is, when the number of the inherited affine candidate and/orthe constructed affine candidate is less than two), the HEVC AMVPcandidate may be added to the affine MVP list of the current block.

For example, the HEVC AMVP candidate may be derived in the followingorder.

Specifically, when the number of the derived affine candidate is lessthan two, and when the CPMV0 of the constructed affine candidate isavailable, the CPMV0 may be used as the affine MVP candidate. That is,when the number of the derived affine candidate is less than two, andwhen the CPMV0 of the constructed affine candidate is available (thatis, when the number of the derived affine candidate is less than two andthe CPMV0 of the constructed affine candidate is derived), a firstaffine MVP candidate including CPMV0 of the constructed affine candidateas CPMV0, CPMV1, CPMV2 may be derived.

Further, next, when the number of the derived affine candidate is lessthan two, and when the CPMV1 of the constructed affine candidate isavailable, the CPMV1 may be used as the affine MVP candidate. That is,when the number of the derived affine candidate is less than two, andwhen the CPMV1 of the constructed affine candidate is available (thatis, when the number of the derived affine candidate is less than two andthe CPMV1 of the constructed affine candidate is derived), a secondaffine MVP candidate including CPMV1 of the constructed affine candidateas CPMV0, CPMV1, CPMV2 may be derived.

Further, next, when the number of the derived affine candidate is lessthan two, and when the CPMV2 of the constructed affine candidate isavailable, the CPMV2 may be used as the affine MVP candidate. That is,when the number of the derived affine candidate is less than two, andwhen the CPMV2 of the constructed affine candidate is available (thatis, when the number of the derived affine candidate is less than two andthe CPMV2 of the constructed affine candidate is derived), a thirdaffine MVP candidate including CPMV2 of the constructed affine candidateas CPMV0, CPMV1, CPMV2 may be derived.

Further, next, when the number of the derived affine candidate is lessthan two, a HEVC temporal motion vector predictor (TMVP) may be used asthe affine MVP candidate. The HEVC TMVP may be derived based on motioninformation of the temporal neighboring block of the current block. Thatis, when the number of the derived affine candidate is less than two, athird affine MVP candidate including the motion vector of the temporalneighboring block of the current block as CPMV0, CPMV1, CPMV2 may bederived. The temporal neighboring block may represent a collocated blockin a collocated picture corresponding to the current block.

Further, next, when the number of the derived affine candidate is lessthan two, a zero motion vector (zero MV) may be used as the affine MVPcandidate. That is, when the number of the derived affine candidate isless than two, a third affine MVP candidate including the zero motionvector as CPMV0, CPMV1, CPMV2 may be derived. The zero motion vector mayrepresent a motion vector whose value is zero.

It can decrease the complexity when compared to the conventional methodof deriving a HEVC AMVP candidate because the steps of using CPMV of theconstructed affine candidate reuse MV which has been already consideredfor generating the constructed affine candidate.

Meanwhile, the present document proposes another example of deriving theinherited affine candidate.

In order to derive the inherited affine candidate, affine predictioninformation of a neighboring block is required, and specifically theaffine prediction information as below is required.

1) Affine_flag indicating whether affine prediction based encoding ofthe neighboring block is applied

2) Motion information of the neighboring block

When the 4-affine motion model is applied to the neighboring block, themotion information of the neighboring block may include L0 motioninformation and L1 motion information for CP0, and L0 motion informationand L1 motion information for CP1. Further, when the 6-affine motionmodel is applied to the neighboring block, the motion information of theneighboring block may include L0 motion information and L1 motioninformation for CP0, and L0 motion information and L1 motion informationfor CP2. Here, the L0 motion information may represent motioninformation on L0 (List 0), and the L1 motion information may representmotion information on L1 (List 1). The L0 motion information may includeL0 reference picture index and L0 motion vector, and the L1 motioninformation may include L1 reference picture index and L1 motion vector.

As described above, in the case of the affine prediction, theinformation amount to be stored is great, which thus may become a majorcause of increasing hardware costs in actually embodying it in theencoding apparatus/decoding apparatus. Particularly, when theneighboring block is located top of the current block and is a CTUboundary, a line buffer should be used to store affineprediction-related information of the neighboring block, and thus thecost problem may occur more greatly. The problem may be representedhereinafter as a line buffer issue. S₀, the present document proposes anexample of deriving an inherited affine candidate, in which the hardwarecost is minimized by not storing the affine prediction-relatedinformation in the line buffer or by reducing it. The proposed examplecan improve coding performance by reducing computational complexity inderiving the inherited affine candidate. Meanwhile, for reference, inthe line buffer the motion information of a block having a 4×4 size hasbeen already stored, and when the affine prediction-related informationis stored, the stored information amount increases three times comparedwith the previous storing amount.

In the present example, in the line buffer no information on the affineprediction may be additionally stored, and when information in the linebuffer should be referenced in order to generate the inherited affinecandidate, the generation of the inherited affine candidate may berestricted.

FIGS. 23 a and 23 b illustratively represent an example of deriving theinherited affine candidate.

Referring to FIG. 23 a , when the neighboring block B of the currentblock (i.e., the top neighboring block of the current block) does notexist in the same CTU (i.e., the current CTU) as the current block, theneighboring block B may not be used for generating the inherited affinecandidate. Meanwhile, even though a neighboring block A does not existin the same CTU as the current block, information on the neighboringblock A may be used for generating the inherited affine candidate as itis not stored in the line buffer. Therefore, in the present example,only when the top neighboring block of the current block is included inthe same CTU as the current block, it may be used for generating theinherited affine candidate. Further, when the top neighboring block ofthe current block is not included in the same CTU as the current block,the top neighboring block may not be used for generating the inheritedaffine candidate.

Referring to FIG. 23 b , the neighboring block B of the current block(i.e., the top neighboring block of the current block) may exist in thesame CTU as the current block. In this case, the encodingapparatus/decoding apparatus may generate the inherited affine candidatewith reference to the neighboring block B.

FIG. 24 schematically represents an image encoding method by an encodingapparatus according to the present document. The method disclosed inFIG. 24 may be performed by the encoding apparatus disclosed in FIG. 2 .Specifically, for example, S2400 to S2430 of FIG. 24 may be performed bythe predictor of the encoding apparatus, and S2440 may be performed bythe entropy encoder of the encoding apparatus. Further, although notshown, the process of deriving prediction samples for the current blockbased on the CPMVs may be performed by the predictor of the encodingapparatus; the process of deriving the residual sample for the currentblock based on the prediction sample and the original sample for thecurrent block, by the subtractor of the encoding apparatus; the processof generating information on residual for the current block based on theresidual sample, by the transformer of the encoding apparatus; and theprocess of encoding the information on residual, by the entropy encoderof the encoding apparatus.

The encoding apparatus configures an affine motion vector predictor(MVP) candidate list for the current block (S2400). The encodingapparatus may configure the affine MVP candidate list including theaffine MVP candidate for the current block. The maximum number of theaffine MVP candidates of the affine MVP candidate list may be two.

Further, as an example, the affine MVP candidate list may include aninherited affine MVP candidate. The encoding apparatus may check whetherthe inherited affine MVP candidate of the current block is available,and when the inherited affine MVP candidate is available, the inheritedaffine MVP candidate may be derived. For example, the inherited affineMVP candidates may be derived based on the neighboring blocks of thecurrent block, and the maximum number of the inherited affine MVPcandidates may be two. The neighboring blocks may be checked in aspecific order whether it is available, and the inherited affine MVPcandidate may be derived based on checked available neighboring block.That is, the neighboring blocks may be checked in a specific orderwhether it is available, and a first inherited affine MVP candidate maybe derived based on the neighboring block which has been first checkedto be available, and a second inherited affine MVP candidate may bederived based on the neighboring block which has been second checked tobe available. The being available may represent that a block is codedwith the affine motion model, and that a reference picture of theneighboring block is the same as a reference picture of the currentblock. That is, the available neighboring block is a neighboring blockwhich is coded with the affine motion model (that is, to which theaffine prediction is applied), and whose reference picture is the sameas a reference picture of the current block. Specifically, the encodingapparatus may derive motion vectors for the CPs of the current blockbased on the affine motion model of the neighboring block which has beenfirst checked to be available, and may derive the first inherited affineMVP candidate including the motion vectors as CPMVP candidates. Further,the encoding apparatus may derive motion vectors for the CPs of thecurrent block based on the affine motion model of the neighboring blockwhich has been second checked to be available, and may derive the secondinherited affine MVP candidate including the motion vectors as CPMVPcandidates. The affine motion model may be derived as foregoing Equation1 or 3.

Further, in other words, the neighboring blocks may be checked in aspecific order whether it satisfies a specific condition, and theinherited affine MVP candidate may be derived based on the neighboringblock which has been checked to satisfy the specific condition. That is,the neighboring blocks may be checked in a specific order whether itsatisfies a specific condition, and the first inherited affine MVPcandidate may be derived based on the neighboring block which has beenfirst checked to satisfy the specific condition, and the secondinherited affine MVP candidate may be derived based on the neighboringblock which has been second checked to satisfy the specific condition.Specifically, the encoding apparatus may derive motion vectors for theCPs of the current block based on the affine motion model of theneighboring block which has been first checked to satisfy the specificcondition, and may derive the first inherited affine MVP candidateincluding the motion vectors as CPMVP candidates. Further, the encodingapparatus may derive motion vectors for the CPs of the current blockbased on the affine motion model of the neighboring block which has beensecond checked to satisfy the specific condition, and may derive thesecond inherited affine MVP candidate including the motion vectors asCPMVP candidates. The affine motion model may be derived as foregoingEquation 1 or 3. Meanwhile, the specific condition may represent that ablock is coded with the affine motion model, and that a referencepicture of the neighboring block is the same as a reference picture ofthe current block. That is, the neighboring block satisfying thespecific condition is a neighboring block which is coded with the affinemotion model (that is, to which the affine prediction is applied), andwhose reference picture is the same as a reference picture of thecurrent block.

Here, for example, the neighboring blocks may include a left neighboringblock, a top neighboring block, a top-right corner neighboring block, abottom-left corner neighboring block, and a top-left corner neighboringblock of the current block. In this case, the specific order may be anorder from the left neighboring block to the bottom-left cornerneighboring block to the top neighboring block to the top-right cornerneighboring block and then to the top-left corner neighboring block.

Alternatively, for example, the neighboring blocks may include only theleft neighboring block and the top neighboring block. In this case, thespecific order may be an order from the left neighboring block to thetop neighboring block.

Alternatively, for example, the neighboring blocks may include only theleft neighboring block, and when the top neighboring block is includedin the current CTU including the current block, the neighboring blocksmay further include the top neighboring block. In this case, thespecific order may be an order from the left neighboring block to thetop neighboring block. Further, when the top neighboring block is notincluded in the current CTU, the neighboring blocks may not include thetop neighboring block. In this case, only the left neighboring block maybe checked.

Meanwhile, if a size is W×H, and x component of the top-left sampleposition of the current block is 0 and y component thereof is 0, thebottom-left corner neighboring block may be a block including a sampleat coordinates (−1, H); the left neighboring block, a block including asample at coordinates (−1, H−1); the top-right corner neighboring block,a block including a sample at coordinates (W, −1); the top neighboringblock, a block including a sample at coordinates (W−1, −1); and thetop-left corner neighboring block, a block including a sample atcoordinates (−1, −1). That is, the left neighboring block may be a leftneighboring block among the left neighboring blocks of the currentblock, which is located lowermost, and the top neighboring block may bea top neighboring block among the top neighboring blocks of the currentblock, which is located leftmost.

Further, as one example, when a constructed affine MVP candidate isavailable, the affine MVP candidate list may include the constructedaffine MVP candidate. The encoding apparatus may check whether theconstructed affine MVP candidate of the current block is available, andwhen the constructed affine MVP candidate is available, the constructedaffine MVP candidate may be derived. Further, for example, after theinherited affine MVP candidate has been derived, the constructed affineMVP candidate may be derived. When the number of the derived affine MVPcandidate (i.e., the inherited affine MVP candidate) is less than twoand the constructed affine MVP candidate is available, the affine MVPcandidate list may include the constructed affine MVP candidate. Here,the constructed affine MVP candidate may include candidate motionvectors for the CPs. The constructed affine MVP candidate may beavailable when all the candidate motion vectors are available.

For example, when the 4-affine motion model is applied to the currentblock, the CPs of the current block may include CP0 and CP1. When themotion vector for the CP0 is available and the motion vector for the CP1is available, the constructed affine MVP candidate may be available, andthe affine MVP candidate list may include the constructed affine MVPcandidate. Here, the CP0 may represent a top-left position of thecurrent block, and the CP1 may represent a top-right position of thecurrent block.

The constructed affine MVP candidate may include a candidate motionvector for the CP0 and a candidate motion vector for the CP1. Thecandidate motion vector for the CP0 may be a motion vector of a firstblock, and the candidate motion vector for the CP1 may be a motionvector of a second block.

Further, the first block may be a block which has been first confirmedwhile checking neighboring blocks in the first group in a first specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. That is, the candidate motion vector forthe CP1 may be a motion vector of a block which has been first confirmedwhile checking neighboring blocks in the first group in a first specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. The being available may represent that theneighboring block exists, and that the neighboring block is coded ininter prediction. Here, when the reference picture of the first block inthe first group is the same as the reference picture of the currentblock, the candidate motion vector for the CP0 may be available.Further, for example, the first group may include the neighboring blockA, the neighboring block B, and the neighboring block C, and the firstspecific order may be an order from the neighboring block A to theneighboring block B, and then to the neighboring block C.

Further, the second block may be a block which has been first confirmedwhile checking neighboring blocks in the second group in a secondspecific order to be that a reference picture thereof is the same as areference picture of the current block. Here, when the reference pictureof the second block in the second group is the same as the referencepicture of the current block, a candidate motion vector for the CP1 maybe available. Further, for example, the second group may include theneighboring block D and the neighboring block E, and the second specificorder may be an order from the neighboring block D to the neighboringblock E.

Meanwhile, if a size of the current block is W×H, and x component of thetop-left sample position of the current block is 0 and y componentthereof is 0, the neighboring block A may be a block including a sampleat coordinates (−1, −1); the neighboring block B, a block including asample at coordinates (0, −1); the neighboring block C, a blockincluding a sample at coordinates (−1, 0); the neighboring block D, ablock including a sample at coordinates (W−1, −1); and the neighboringblock E, a block including a sample at coordinates (W, −1). That is, theneighboring block A may be the top-left corner neighboring block of thecurrent block; the neighboring block B, the top neighboring block amongthe top neighboring blocks of the current block, which is locatedleftmost; the neighboring block C, the left neighboring block among theleft neighboring blocks of the current block, which is locateduppermost; the neighboring block D, the top neighboring block among thetop neighboring blocks of the current block, which is located rightmost;and the neighboring block E, the top-right corner neighboring block ofthe current block.

Meanwhile, when at least one of the candidate motion vector of the CP0and the candidate motion vector of the CP1 is not available, theconstructed affine MVP candidate may not be available.

Alternatively, for example, when the 6-affine motion model is applied tothe current block, the CPs of the current block may include CP0, CP1 andCP2. When the motion vector for the CP0 is available and the motionvector for the CP1 is available and the motion vector for the CP2 isavailable, the constructed affine MVP candidate may be available, andthe affine MVP candidate list may include the constructed affine MVPcandidate. Here, the CP0 may represent a top-left position of thecurrent block; the CP1, a top-right position of the current block; andthe CP2, a bottom-left position of the current block.

The constructed affine MVP candidate may include the candidate motionvector for the CP0, the candidate motion vector for the CP1, and thecandidate motion vector for the CP2. The candidate motion vector for theCP0 may be a motion vector of a first block, the candidate motion vectorfor the CP1 may be a motion vector of a second block, and the candidatemotion vector for the CP2 may be a motion vector of a third block.

Further, the first block may be a block which has been first confirmedwhile checking neighboring blocks in the first group in a first specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. Here, when the reference picture of thefirst block in the first group is the same as the reference picture ofthe current block, the candidate motion vector for the CP0 may beavailable. Further, for example, the first group may include theneighboring block A, the neighboring block B, and the neighboring blockC, and the first specific order may be an order from the neighboringblock A to the neighboring block B, and then to the neighboring block C.

Further, the second block may be a block which has been first confirmedwhile checking neighboring blocks in the second group in a secondspecific order to be that a reference picture thereof is the same as areference picture of the current block. Here, when the reference pictureof the second block in the second group is the same as the referencepicture of the current block, a candidate motion vector for the CP1 maybe available. Further, for example, the second group may include theneighboring block D and the neighboring block E, and the second specificorder may be an order from the neighboring block D to the neighboringblock E.

Further, the third block may be a block which has been first confirmedwhile checking neighboring blocks in the third group in a third specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. Here, when the reference picture of thethird block in the third group is the same as the reference picture ofthe current block, the candidate motion vector for the CP2 may beavailable. Further, for example, the third group may include theneighboring block F, and the neighboring block G, and the third specificorder may be an order from the neighboring block F to the neighboringblock G.

Meanwhile, if a size of the current block is W×H, and x component of thetop-left sample position of the current block is 0 and y componentthereof is 0, the neighboring block A may be a block including a sampleat coordinates (−1, −1); the neighboring block B, a block including asample at coordinates (0, −1); the neighboring block C, a blockincluding a sample at coordinates (−1, 0); the neighboring block D, ablock including a sample at coordinates (W−1, −1); the neighboring blockE, a block including a sample at coordinates (W, −1); the neighboringblock F, a block including a sample at coordinates (−1, H−1); and theneighboring block G, a block including a sample at coordinates (−1, H).That is, the neighboring block A may be the top-left corner neighboringblock of the current block; the neighboring block B, the top neighboringblock among the top neighboring blocks of the current block, which islocated leftmost; the neighboring block C, the left neighboring blockamong the left neighboring blocks of the current block, which is locateduppermost; the neighboring block D, the top neighboring block among thetop neighboring blocks of the current block, which is located rightmost;the neighboring block E, the top-right corner neighboring block of thecurrent block; the neighboring block F, the left neighboring block amongthe left neighboring blocks of the current block, which is locatedlowermost; and the neighboring block G, the bottom-left cornerneighboring block of the current block.

Meanwhile, when at least one of the candidate motion vector of the CP0,the candidate motion vector of the CP1, and the candidate motion vectorof CP2 is not available, the constructed affine MVP candidate may not beavailable.

After this, the affine MVP candidate list may be derived based onbelow-described steps in a particular order.

For example, when the number of the derived affine MVP candidate is lessthan two, and the motion vector for the CP0 is available, the encodingapparatus may derive a first affine MVP candidate. Here, the firstaffine MVP candidate may be an affine MVP candidate including a motionvector for the CP0 as candidate motion vectors for the CPs.

Further, for example, when the number of the derived affine MVPcandidate is less than two, and the motion vector for the CP1 isavailable, the encoding apparatus may derive a second affine MVPcandidate. Here, the second affine MVP candidate may be an affine MVPcandidate including a motion vector for the CP1 as candidate motionvectors for the CPs.

Further, for example, when the number of the derived affine MVPcandidate is less than two, and the motion vector for the CP2 isavailable, the encoding apparatus may derive a third affine MVPcandidate. Here, the third affine MVP candidate may be an affine MVPcandidate including a motion vector for the CP2 as candidate motionvectors for the CPs.

Further, for example, when the number of the derived affine MVPcandidate is less than two, the encoding apparatus may derive a fourthaffine MVP candidate including as candidate motion vectors for the CPs atemporal MVP derived based on the temporal neighboring block of thecurrent block. The temporal neighboring block may represent a collocatedblock in a collocated picture corresponding to the current block. Thetemporal MVP may be derived based on a motion vector of the temporalneighboring block.

Further, for example, when the number of the derived affine MVPcandidate is less than two, the encoding apparatus may derive a fifthaffine MVP candidate including a zero motion vector as candidate motionvectors for the CPs. The zero motion vector may represent a motionvector whose value is zero.

The encoding apparatus derives control point motion vector predictors(CPMVPs) for control points (CPs) of the current block based on theaffine MVP candidate list (S2410). The encoding apparatus may deriveCPMVs for the CPs of the current block which has optimal RD cost, andmay select as the affine MVP candidate for the current block the affineMVP candidate from among the affine MVP candidates, which is mostsimilar to the CPMVs. The encoding apparatus may derive control pointmotion vector predictors (CPMVPs) for control points (CPs) of thecurrent block based on the selected affine MVP candidate from among theaffine MVP candidates included in the affine MVP candidate list.Specifically, when the affine MVP candidate includes the candidatemotion vector for CP0 and the candidate motion vector for CP1, thecandidate motion vector for CP0 of the affine MVP candidate may bederived as the CPMVP of the CP0, and the candidate motion vector for CP1of the affine MVP candidate may be derived as the CPMVP of the CP1.Further, when the affine MVP candidate includes the candidate motionvector for CP0, the candidate motion vector for CP1, and the candidatemotion vector for CP2, the candidate motion vector for CP0 of the affineMVP candidate may be derived as CPMVP of the CP0, the candidate motionvector for CP1 of the affine MVP candidate may be derived as CPMVP ofthe CP1, and the candidate motion vector for CP2 of the affine MVPcandidate may be derived as CPMVP of the CP2. Further, when the affineMVP candidate includes the candidate motion vector for CP0 and thecandidate motion vector for CP2, the candidate motion vector for CP0 ofthe affine MVP candidate may be derived as the CPMVP of the CP0, and thecandidate motion vector for CP2 of the affine MVP candidate may bederived as the CPMVP of the CP2.

The encoding apparatus may encode an affine MVP candidate indexindicating the selected affine MVP candidate from among the affine MVPcandidates. The affine MVP candidate index may indicate the one affineMVP candidate among the affine MVP candidates included in the affinemotion vector predictor (MVP) candidate list for the current block.

The encoding apparatus derives CPMVs for the CPs of the current block(S2420). The encoding apparatus may derive CPMVs for the respective CPsof the current block.

The encoding apparatus derives control point motion vector differences(CPMVDs) for the CPs of the current block based on the CPMVPs and theCPMVs (S2430). The encoding apparatus may derive CPMVDs for the CPs ofthe current block based on the CPMVPs and the CPMVs for the respectiveCPs.

The encoding apparatus encodes motion prediction information includinginformation on the CPMVDs (S2440). The encoding apparatus may output, inthe form of a bitstream, motion prediction information includinginformation on the CPMVDs. That is, the encoding apparatus may output,in the form of a bitstream, image information including the motionprediction information. The encoding apparatus may encode information onCPMVD for the respective CPs, and the motion prediction information mayinclude information on the CPMVDs.

Further, the motion prediction information may include the affine MVPcandidate index. The affine MVP candidate index may indicate theselected affine MVP candidate among the affine MVP candidates includedin the affine motion vector predictor (MVP) candidate list for thecurrent block.

Meanwhile, as an example, the encoding apparatus may derive predictionsamples for the current block based on the CPMVs, derive the residualsample for the current block based on prediction sample and originalsample for the current block, generate information on residual for thecurrent block based on the residual sample, and encode information onthe residual. The image information may include information on theresidual. Meanwhile, the bitstream may be transmitted to the decodingapparatus through a network or a (digital) storage medium. Here, thenetwork may include a broadcast network, a communication network and/orthe like, and the digital storage medium may include various storagemedia such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and the like.

FIG. 25 schematically represents an encoding apparatus performing animage encoding method according to the present document. The methoddisclosed in FIG. 24 may be performed by the encoding apparatusdisclosed in FIG. 25 . Specifically, for example, the predictor of FIG.25 may perform S2400 to S2410 in FIG. 24 ; and the entropy encoder ofthe encoding apparatus, S2420 in FIG. 24 . Further, although not shown,the process of deriving prediction samples for the current block basedon the CPMVs may be performed by the predictor of the encoding apparatusof FIG. 25 ; the process of deriving the residual sample for the currentblock based on the prediction sample and the original sample for thecurrent block, by the subtractor of the encoding apparatus of FIG. 25 ;the process of generating information on residual for the current blockbased on the residual sample, by the transformer of the encodingapparatus of FIG. 25 ; and the process of encoding the information onresidual, by the entropy encoder of the encoding apparatus of FIG. 25 .

FIG. 26 schematically represents an image decoding method by a decodingapparatus according to the present document. The method disclosed inFIG. 26 may be performed by the decoding apparatus disclosed in FIG. 3 .Specifically, for example, S2600 of FIG. 26 may be performed by theentropy decoder of the decoding apparatus; S2610 to S2650, by thepredictor of the decoding apparatus; and S2660, by the adder of thedecoding apparatus. Further, although not shown, the process ofobtaining information on residual of the current block through abitstream may be performed by the entropy decoder of the decodingapparatus, and the process of deriving the residual sample for thecurrent block based on the residual information may be performed by theinverse transformer of the decoding apparatus.

The decoding apparatus obtains motion prediction information for thecurrent block from a bitstream (S2600). The decoding apparatus mayobtain image information including the motion prediction informationfrom the bitstream.

Further, for example, the motion prediction information may includeinformation on control point motion vector differences (CPMVDs) forcontrol points (CPs) of the current block. That is, the motionprediction information may include information on CPMVD for respectiveCPs of the current block.

Further, for example, the motion prediction information may include theaffine MVP candidate index for the current block. The affine MVPcandidate index may indicate one among the affine MVP candidatesincluded in the affine motion vector predictor (MVP) candidate list forthe current block.

The decoding apparatus configures an affine motion vector predictor(MVP) candidate list for the current block (S2610). The decodingapparatus may configure an affine MVP candidate list including theaffine MVP candidate for the current block. The maximum number of theaffine MVP candidates of the affine MVP candidate list may be two.

Further, as an example, the affine MVP candidate list may include aninherited affine MVP candidate. The decoding apparatus may check whetherthe inherited affine MVP candidate of the current block is available,and when the inherited affine MVP candidate is available, the inheritedaffine MVP candidate may be derived. For example, the inherited affineMVP candidates may be derived based on the neighboring blocks of thecurrent block, and the maximum number of the inherited affine MVPcandidates may be two. The neighboring blocks may be checked in aspecific order whether it is available, and the inherited affine MVPcandidate may be derived based on checked available neighboring block.That is, the neighboring blocks may be checked in a specific orderwhether it is available, and a first inherited affine MVP candidate maybe derived based on the neighboring block which has been first checkedto be available, and a second inherited affine MVP candidate may bederived based on the neighboring block which has been second checked tobe available. The being available may represent that a block is codedwith the affine motion model, and that a reference picture of theneighboring block is the same as a reference picture of the currentblock. That is, the available neighboring block is a neighboring blockwhich is coded with the affine motion model (that is, to which theaffine prediction is applied), and whose reference picture is the sameas a reference picture of the current block. Specifically, the decodingapparatus may derive motion vectors for the CPs of the current blockbased on the affine motion model of the neighboring block which has beenfirst checked to be available, and may derive the first inherited affineMVP candidate including the motion vectors as CPMVP candidates. Further,the decoding apparatus may derive motion vectors for the CPs of thecurrent block based on the affine motion model of the neighboring blockwhich has been second checked to be available, and may derive the secondinherited affine MVP candidate including the motion vectors as CPMVPcandidates. The affine motion model may be derived as foregoing Equation1 or 3.

Further, in other words, the neighboring blocks may be checked in aspecific order whether it satisfies a specific condition, and theinherited affine MVP candidate may be derived based on the neighboringblock which has been checked to satisfy the specific condition. That is,the neighboring blocks may be checked in a specific order whether itsatisfies a specific condition, and the first inherited affine MVPcandidate may be derived based on the neighboring block which has beenfirst checked to satisfy the specific condition, and the secondinherited affine MVP candidate may be derived based on the neighboringblock which has been second checked to satisfy the specific condition.Specifically, the decoding apparatus may derive motion vectors for theCPs of the current block based on the affine motion model of theneighboring block which has been first checked to satisfy the specificcondition, and may derive the first inherited affine MVP candidateincluding the motion vectors as CPMVP candidates. Further, the decodingapparatus may derive motion vectors for the CPs of the current blockbased on the affine motion model of the neighboring block which has beensecond checked to satisfy the specific condition, and may derive thesecond inherited affine MVP candidate including the motion vectors asCPMVP candidates. The affine motion model may be derived as foregoingEquation 1 or 3. Meanwhile, the specific condition may represent that ablock is coded with the affine motion model, and that a referencepicture of the neighboring block is the same as a reference picture ofthe current block. That is, the neighboring block satisfying thespecific condition is a neighboring block which is coded with the affinemotion model (that is, to which the affine prediction is applied), andwhose reference picture is the same as a reference picture of thecurrent block.

Here, for example, the neighboring blocks may include a left neighboringblock, a top neighboring block, a top-right corner neighboring block, abottom-left corner neighboring block, and a top-left corner neighboringblock of the current block. In this case, the specific order may be anorder from the left neighboring block to the bottom-left cornerneighboring block to the top neighboring block to the top-right cornerneighboring block and then to the top-left corner neighboring block.

Alternatively, for example, the neighboring blocks may include only theleft neighboring block and the top neighboring block. In this case, thespecific order may be an order from the left neighboring block to thetop neighboring block.

Alternatively, for example, the neighboring blocks may include only theleft neighboring block, and when the top neighboring block is includedin the current CTU including the current block, the neighboring blocksmay further include the top neighboring block. In this case, thespecific order may be an order from the left neighboring block to thetop neighboring block. Further, when the top neighboring block is notincluded in the current CTU, the neighboring blocks may not include thetop neighboring block. In this case, only the left neighboring block maybe checked.

Meanwhile, if a size is W×H, and x component of the top-left sampleposition of the current block is 0 and y component thereof is 0, thebottom-left corner neighboring block may be a block including a sampleat coordinates (−1, H); the left neighboring block, a block including asample at coordinates (−1, H−1); the top-right corner neighboring block,a block including a sample at coordinates (W, −1); the top neighboringblock, a block including a sample at coordinates (W−1, −1); and thetop-left corner neighboring block, a block including a sample atcoordinates (−1, −1). That is, the left neighboring block may be a leftneighboring block among the left neighboring blocks of the currentblock, which is located lowermost, and the top neighboring block may bea top neighboring block among the top neighboring blocks of the currentblock, which is located leftmost.

Further, as one example, when a constructed affine MVP candidate isavailable, the affine MVP candidate list may include the constructedaffine MVP candidate. The decoding apparatus may check whether theconstructed affine MVP candidate of the current block is available, andwhen the constructed affine MVP candidate is available, the constructedaffine MVP candidate may be derived. Further, for example, after theinherited affine MVP candidate has been derived, the constructed affineMVP candidate may be derived. When the number of the derived affine MVPcandidate (i.e., the inherited affine MVP candidate) is less than twoand the constructed affine MVP candidate is available, the affine MVPcandidate list may include the constructed affine MVP candidate. Here,the constructed affine MVP candidate may include candidate motionvectors for the CPs. The constructed affine MVP candidate may beavailable when all the candidate motion vectors are available.

For example, when the 4-affine motion model is applied to the currentblock, the CPs of the current block may include CP0 and CP1. When themotion vector for the CP0 is available and the motion vector for the CP1is available, the constructed affine MVP candidate may be available, andthe affine MVP candidate list may include the constructed affine MVPcandidate. Here, the CP0 may represent a top-left position of thecurrent block, and the CP1 may represent a top-right position of thecurrent block.

The constructed affine MVP candidate may include a candidate motionvector for the CP0 and a candidate motion vector for the CP1. Thecandidate motion vector for the CP0 may be a motion vector of a firstblock, and the candidate motion vector for the CP1 may be a motionvector of a second block.

Further, the first block may be a block which has been first confirmedwhile checking neighboring blocks in the first group in a first specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. That is, the candidate motion vector forthe CP1 may be a motion vector of a block which has been first confirmedwhile checking neighboring blocks in the first group in a first specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. The being available may represent that theneighboring block exists, and that the neighboring block is coded ininter prediction. Here, when the reference picture of the first block inthe first group is the same as the reference picture of the currentblock, the candidate motion vector for the CP0 may be available.Further, for example, the first group may include the neighboring blockA, the neighboring block B, and the neighboring block C, and the firstspecific order may be an order from the neighboring block A to theneighboring block B, and then to the neighboring block C.

Further, the second block may be a block which has been first confirmedwhile checking neighboring blocks in the second group in a secondspecific order to be that a reference picture thereof is the same as areference picture of the current block. Here, when the reference pictureof the second block in the second group is the same as the referencepicture of the current block, a candidate motion vector for the CP1 maybe available. Further, for example, the second group may include theneighboring block D and the neighboring block E, and the second specificorder may be an order from the neighboring block D to the neighboringblock E.

Meanwhile, if a size of the current block is W×H, and x component of thetop-left sample position of the current block is 0 and y componentthereof is 0, the neighboring block A may be a block including a sampleat coordinates (−1, −1); the neighboring block B, a block including asample at coordinates (0, −1); the neighboring block C, a blockincluding a sample at coordinates (−1, 0); the neighboring block D, ablock including a sample at coordinates (W−1, −1); and the neighboringblock E, a block including a sample at coordinates (W, −1). That is, theneighboring block A may be the top-left corner neighboring block of thecurrent block; the neighboring block B, the top neighboring block amongthe top neighboring blocks of the current block, which is locatedleftmost; the neighboring block C, the left neighboring block among theleft neighboring blocks of the current block, which is locateduppermost; the neighboring block D, the top neighboring block among thetop neighboring blocks of the current block, which is located rightmost;and the neighboring block E, the top-right corner neighboring block ofthe current block.

Meanwhile, when at least one of the candidate motion vector of the CP0and the candidate motion vector of the CP1 is not available, theconstructed affine MVP candidate may not be available.

Alternatively, for example, when the 6-affine motion model is applied tothe current block, the CPs of the current block may include CP0, CP1 andCP2. When the motion vector for the CP0 is available and the motionvector for the CP1 is available and the motion vector for the CP2 isavailable, the constructed affine MVP candidate may be available, andthe affine MVP candidate list may include the constructed affine MVPcandidate. Here, the CP0 may represent a top-left position of thecurrent block; the CP1, a top-right position of the current block; andthe CP2, a bottom-left position of the current block.

The constructed affine MVP candidate may include the candidate motionvector for the CP0, the candidate motion vector for the CP1, and thecandidate motion vector for the CP2. The candidate motion vector for theCP0 may be a motion vector of a first block, the candidate motion vectorfor the CP1 may be a motion vector of a second block, and the candidatemotion vector for the CP2 may be a motion vector of a third block.

Further, the first block may be a block which has been first confirmedwhile checking neighboring blocks in the first group in a first specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. Here, when the reference picture of thefirst block in the first group is the same as the reference picture ofthe current block, the candidate motion vector for the CP0 may beavailable. Further, for example, the first group may include theneighboring block A, the neighboring block B, and the neighboring blockC, and the first specific order may be an order from the neighboringblock A to the neighboring block B, and then to the neighboring block C.

Further, the second block may be a block which has been first confirmedwhile checking neighboring blocks in the second group in a secondspecific order to be that a reference picture thereof is the same as areference picture of the current block. Here, when the reference pictureof the second block in the second group is the same as the referencepicture of the current block, a candidate motion vector for the CP1 maybe available. Further, for example, the second group may include theneighboring block D and the neighboring block E, and the second specificorder may be an order from the neighboring block D to the neighboringblock E.

Further, the third block may be a block which has been first confirmedwhile checking neighboring blocks in the third group in a third specificorder to be that a reference picture thereof is the same as a referencepicture of the current block. Here, when the reference picture of thethird block in the third group is the same as the reference picture ofthe current block, the candidate motion vector for the CP2 may beavailable. Further, for example, the third group may include theneighboring block F, and the neighboring block G, and the third specificorder may be an order from the neighboring block F to the neighboringblock G.

Meanwhile, if a size of the current block is W×H, and x component of thetop-left sample position of the current block is 0 and y componentthereof is 0, the neighboring block A may be a block including a sampleat coordinates (−1, −1); the neighboring block B, a block including asample at coordinates (0, −1); the neighboring block C, a blockincluding a sample at coordinates (−1, 0); the neighboring block D, ablock including a sample at coordinates (W−1, −1); the neighboring blockE, a block including a sample at coordinates (W, −1); the neighboringblock F, a block including a sample at coordinates (−1, H−1); and theneighboring block G, a block including a sample at coordinates (−1, H).That is, the neighboring block A may be the top-left corner neighboringblock of the current block; the neighboring block B, the top neighboringblock among the top neighboring blocks of the current block, which islocated leftmost; the neighboring block C, the left neighboring blockamong the left neighboring blocks of the current block, which is locateduppermost; the neighboring block D, the top neighboring block among thetop neighboring blocks of the current block, which is located rightmost;the neighboring block E, the top-right corner neighboring block of thecurrent block; the neighboring block F, the left neighboring block amongthe left neighboring blocks of the current block, which is locatedlowermost; and the neighboring block G, the bottom-left cornerneighboring block of the current block.

Meanwhile, when at least one of the candidate motion vector of the CP0,the candidate motion vector of the CP1, and the candidate motion vectorof CP2 is not available, the constructed affine MVP candidate may not beavailable.

After this, the affine MVP candidate list may be derived based onbelow-described steps in a particular order.

For example, when the number of the derived affine MVP candidate is lessthan two, and the motion vector for the CP0 is available, the decodingapparatus may derive a first affine MVP candidate. Here, the firstaffine MVP candidate may be an affine MVP candidate including a motionvector for the CP0 as candidate motion vectors for the CPs.

Further, for example, when the number of the derived affine MVPcandidate is less than two, and the motion vector for the CP1 isavailable, the decoding apparatus may derive a second affine MVPcandidate. Here, the second affine MVP candidate may be an affine MVPcandidate including a motion vector for the CP1 as candidate motionvectors for the CPs.

Further, for example, when the number of the derived affine MVPcandidate is less than two, and the motion vector for the CP2 isavailable, the decoding apparatus may derive a third affine MVPcandidate. Here, the third affine MVP candidate may be an affine MVPcandidate including a motion vector for the CP2 as candidate motionvectors for the CPs.

Further, for example, when the number of the derived affine MVPcandidate is less than two, the decoding apparatus may derive a fourthaffine MVP candidate including as candidate motion vectors for the CPs atemporal MVP derived based on the temporal neighboring block of thecurrent block. The temporal neighboring block may represent a collocatedblock in a collocated picture corresponding to the current block. Thetemporal MVP may be derived based on a motion vector of the temporalneighboring block.

Further, for example, when the number of the derived affine MVPcandidate is less than two, the decoding apparatus may derive a fifthaffine MVP candidate including a zero motion vector as candidate motionvectors for the CPs. The zero motion vector may represent a motionvector whose value is zero.

The decoding apparatus derives control point motion vector predictors(CPMVPs) for control points (CPs) of the current block based on theaffine MVP candidate list (S2620).

The decoding apparatus may select a specific affine MVP candidate fromamong the affine MVP candidates included in the affine MVP candidatelist, and may derive the selected affine MVP candidate as CPMVPs for theCPs of the current block. For example, the decoding apparatus may obtainthe affine MVP candidate index for the current block from the bitstream,and may derive as CPMVPs for the CPs of the current block the affine MVPcandidate among the affine MVP candidates included in the affine MVPcandidate list, which the affine MVP candidate index indicates.Specifically, when the affine MVP candidate includes the candidatemotion vector for CP0 and the candidate motion vector for CP1, thecandidate motion vector for CP0 of the affine MVP candidate may bederived as the CPMVP of the CP0, and the candidate motion vector for CP1of the affine MVP candidate may be derived as the CPMVP of the CP1.Further, when the affine MVP candidate includes the candidate motionvector for CP0, the candidate motion vector for CP1, and the candidatemotion vector for CP2, the candidate motion vector for CP0 of the affineMVP candidate may be derived as CPMVP of the CP0, the candidate motionvector for CP1 of the affine MVP candidate may be derived as CPMVP ofthe CP1, and the candidate motion vector for CP2 of the affine MVPcandidate may be derived as CPMVP of the CP2. Further, when the affineMVP candidate includes the candidate motion vector for CP0 and thecandidate motion vector for CP2, the candidate motion vector for CP0 ofthe affine MVP candidate may be derived as the CPMVP of the CP0, and thecandidate motion vector for CP2 of the affine MVP candidate may bederived as the CPMVP of the CP2.

The decoding apparatus derives control point motion vector differences(CPMVDs) for the CPs of the current block based on the motion predictioninformation (S2630). The motion prediction information may includeinformation on CPMVD for the respective CPs, and the decoding apparatusmay derive the CPMVD for the respective CPs of the current block basedon information on the CPMVD for the respective CPs.

The decoding apparatus derives control point motion vectors (CPMVs) forthe CPs of the current block based on the CPMVPs and the CPMVDs (S2640).The decoding apparatus may derive CPMV for each CP based on CPMVD andCPMVP for the respective CPs. For example, the decoding apparatus mayderive CPMV for the CP by adding CPMVD and CPMVP for each CP.

The decoding apparatus may derive the prediction samples for the currentblock based on the CPMVs (S2650). The decoding apparatus may derivemotion vectors of sub-block units or sample units of the current blockbased on the CPMVs. That is, the decoding apparatus may derive motionvector of each sub-block or each sample of the current block based onthe CPMVs. The motion vectors of the subblock units or the sample unitsmay be derived based on above-described Equation 1 or Equation 3. Themotion vectors may be represented as an affine motion vector field (MVF)or a motion vector array

The decoding apparatus may derive prediction samples for the currentblock based on motion vectors of the sub-block units or the sampleunits. The decoding apparatus may derive a reference area in a referencepicture based on motion vectors of the sub-block unit or the sampleunit, and generate a prediction sample of the current block based onreconstructed sample in the reference area.

The decoding apparatus generates a reconstructed picture for the currentblock based on the derived prediction samples (S2660). The decodingapparatus may generate a reconstructed picture for the current blockbased on the derived prediction samples. The decoding apparatus may usea prediction sample directly as a reconstructed sample according toprediction mode, or may generate a reconstructed sample by adding aresidual sample to the prediction sample. If there exists a residualsample for the current block, the decoding apparatus may acquireinformation on residual for the current block from the bitstream. Theinformation on residual may include a transform coefficient relating tothe residual sample. The decoding apparatus may derive the residualsample (or residual sample array) for the current block based oninformation on the residual. The decoding apparatus may generate areconstructed sample based on the prediction sample and the residualsample, and derive a reconstructed block or reconstructed picture basedon the reconstructed sample. After this, as described above, thedecoding apparatus may apply an in-loop filtering procedure such as anSAO procedure and/or deblocking filtering to the reconstructed picturein order to improve subjective/objective video quality as needed.

FIG. 27 schematically represents a decoding apparatus performing animage decoding method according to the document. The method disclosed inFIG. 26 may be performed by the decoding apparatus disclosed in FIG. 27. Specifically, for example, an entropy decoder of the decodingapparatus of FIG. 27 may perform S2600 of FIG. 26 ; a predictor of thedecoding apparatus of FIG. 27 , S2610 to S2650 of FIG. 26 ; and an adderof the decoding apparatus of FIG. 27 , S2660 of FIG. 26 . Further,although not shown, the process of obtaining image information includinginformation on residual of the current block through a bitstream may beperformed by the entropy decoder of the decoding apparatus of FIG. 27 ,and the process of deriving the residual sample for the current blockbased on the residual information may be performed by the inversetransformer of the decoding apparatus of FIG. 27 .

According to the above-described present document, it is possible toincrease the efficiency of image coding based on the affine motionprediction.

Further, according to the present document, in deriving the affine MVPcandidate list, only when all the candidate motion vectors for the CPsof the constructed affine MVP candidate are available, the constructedaffine MVP candidate may be added, through which it is possible toreduce the complexity of the process of deriving the constructed affineMVP candidate and the process of configuring the affine MVP candidatelist, and to improve the coding efficiency.

Further, according to the present document, in deriving the affine MVPcandidate list, the additional affine MVP candidate may be derived basedon the candidate motion vector for the CP derived in the process ofderiving the constructed affine MVP candidate, through which it ispossible to reduce the complexity of the process of configuring theaffine MVP candidate list, and to improve the coding efficiency.

Further, according to the present document, in the process of derivingthe inherited affine MVP candidate, only when the top neighboring blockis included in the current CTU, the inherited affine MVP candidate maybe derived using the top neighboring block, through which it is possibleto reduce the storing amount of the line buffer for affine prediction,and to minimize hardware costs.

In the above-described embodiment, the methods are explained on thebasis of a flowchart by means of a series of steps or blocks, but thepresent document is not limited to the order of steps, and a certainstep may occur in a different order or concurrently with other stepsthan those described above. Further, it may be understood by a personhaving ordinary skill in the art that the steps shown in a flowchart isnot exclusive, and that another step may be incorporated or one or moresteps of the flowchart may be removed without affecting the scope of thepresent document.

Further, embodiments described in the present document may be embodiedand performed on a processor, a microprocessor, a controller or a chip.For example, function units shown in each drawing may be embodied andperformed on a processor, a microprocessor, a controller or a chip. Inthis case, information or algorithm for embodying (e.g., information oninstruction) may be stored in a digital storage medium.

Further, the decoding apparatus and the encoding apparatus to which thepresent document is applied may be included in a multimedia broadcastingtransceiver, a mobile communication terminal, a home cinema videodevice, a digital cinema video device, a surveillance camera, a videochat device, a real time communication device such as videocommunication, a mobile streaming device, a storage medium, a camcorder,a video on demand (VoD) service providing device, an over the top (OTT)video device, an internet streaming service providing device, athree-dimensional (3D) video device, a video telephony video device, atransportation means terminal (e.g., a vehicle terminal, an aircraftterminal, a ship terminal, etc.) and a medical video device, and may beused to process a video signal or a data signal. For example, the overthe top (OTT) video device may include a game console, a Blu-ray player,an Internet access TV, a Home theater system, a smartphone, a Tablet PC,a digital video recorder (DVR) and the like.

In addition, the processing method to which the present document isapplied may be produced in the form of a program executed by a computer,and be stored in a computer-readable recording medium. Multimedia datahaving a data structure according to the present document may be alsostored in a computer-readable recording medium. The computer-readablerecording medium includes all kinds of storage devices and distributionstorage devices in which computer-readable data are stored. Thecomputer-readable recording medium may include, for example, a Blu-rayDisc (BD), a Universal Serial Bus (USB), a ROM, a PROM, an EPROM, anEEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk and an opticaldata storage device. Further, the computer-readable recording mediumalso includes media embodied in the form of a carrier wave (for example,transmission over the Internet). In addition, the bit stream generatedby the encoding method may be stored in a computer-readable recordingmedium or transmitted through a wired or wireless communication network.

Additionally, the embodiment of the present document may be embodied asa computer program product by program codes, and the program codes maybe performed in a computer by the embodiment of the present document.The program codes may be stored on a computer-readable carrier.

FIG. 28 represents an example of a contents streaming system to whichthe embodiments disclosed in the present document may be applied.

Referring to FIG. 28 , the content streaming system to which theembodiment(s) of the present document is applied may largely include anencoding server, a streaming server, a web server, a media storage, auser device, and a multimedia input device.

The encoding server compresses content input from multimedia inputdevices such as a smartphone, a camera, a camcorder, etc. into digitaldata to generate a bitstream and transmit the bitstream to the streamingserver. As another example, when the multimedia input devices such assmartphones, cameras, camcorders, etc. directly generate a bitstream,the encoding server may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgenerating method to which the embodiment(s) of the present document isapplied, and the streaming server may temporarily store the bitstream inthe process of transmitting or receiving the bitstream.

The streaming server transmits the multimedia data to the user devicebased on a user's request through the web server, and the web serverserves as a medium for informing the user of a service. When the userrequests a desired service from the web server, the web server deliversit to a streaming server, and the streaming server transmits multimediadata to the user. In this case, the content streaming system may includea separate control server. In this case, the control server serves tocontrol a command/response between devices in the content streamingsystem.

The streaming server may receive content from a media storage and/or anencoding server. For example, when the content is received from theencoding server, the content may be received in real time. In this case,in order to provide a smooth streaming service, the streaming server maystore the bitstream for a predetermined time.

Examples of the user device may include a mobile phone, a smartphone, alaptop computer, a digital broadcasting terminal, a personal digitalassistant (PDA), a portable multimedia player (PMP), navigation, a slatePC, tablet PCs, ultrabooks, wearable devices (ex. smartwatches, smartglasses, head mounted displays), digital TVs, desktops computer, digitalsignage, and the like. Each server in the content streaming system maybe operated as a distributed server, in which case data received fromeach server may be distributed.

Each of servers in the contents streaming system may be operated as adistributed server, and in this case, data received by each server maybe distributedly processed.

What is claimed is:
 1. An image decoding method, by a decodingapparatus, comprising: obtaining motion prediction information for acurrent block from a bitstream; configuring an affine motion vectorpredictor (MVP) candidate list for the current block; deriving controlpoint motion vector predictors (CPMVPs) for control points (CPs) of thecurrent block based on the affine MVP candidate list; deriving controlpoint motion vector differences (CPMVDs) for CPs of the current blockbased on the motion prediction information; deriving control pointmotion vectors (CPMVs) for CPs of the current block based on the CPMVPsand the CPMVDs; deriving prediction samples for the current block basedon the CPMVs; and generating a reconstructed picture for the currentblock based on the derived prediction samples, wherein the configuringof the affine MVP candidate list comprises: checking whether a firstaffine MVP candidate is available, wherein the first affine MVPcandidate is available based on a first block in a left block groupbeing coded with an affine motion model and a reference picture index ofthe first block being same as a reference picture index of the currentblock; checking whether a second affine MVP candidate is available,wherein the second affine MVP candidate is available based on a secondblock in a top block group being coded with the affine motion model anda reference picture index of the second block being same as a referencepicture index of the current block, wherein the left block groupincludes a bottom-left corner neighboring block of the current block,and a first left neighboring block adjacent to an upper side of thebottom-left corner neighboring block, and wherein the top block groupincludes a top-right corner neighboring block of the current block, afirst top neighboring block adjacent to a left side of the top-rightcorner neighboring block, and a top-left corner block; and checkingwhether a third affine MVP candidate available when a number of theavailable affine MVP candidate is less than 2, wherein a 6-parameteraffine mode is used to an inter prediction, wherein for the 6-parameteraffine model being used to the inter prediction, the third MVP affinecandidate is available based on the first motion vector for the CP0, thesecond motion vector for the CP1 and a third motion vector for CP2 ofthe current block being derived from a top-left block group of thecurrent block, a top-right block group of the current block and the leftblock group respectively, and wherein the top-left block group includesa top-left corner neighboring block of the current block, a second leftneighboring block adjacent to a bottom side of the top-left cornerneighboring block, and a second top neighboring block adjacent to aright side of the top-left corner neighboring block, and the top-rightblock group includes a top-right corner neighboring block and a topneighboring block.
 2. The image decoding method of claim 1, wherein theconfiguring of the affine MVP candidate list comprises; deriving afourth affine MVP candidate to a sixth affine MVP candidate based on thenumber of available affine MVP candidates being less than 2, wherein thefourth affine MVP candidate to the sixth affine MVP candidate include anavailable first motion vector for the CP0, an available second motionvector for the CP1 and an available third motion vector for CP2 ascandidate motion vectors for the CPs.
 3. The image decoding method ofclaim 2, wherein the configuring of the affine MVP candidate listcomprises; deriving a seventh affine MVP candidate including a temporalMVP as candidate motion vectors for the CPs based on the number ofavailable affine MVP candidates being less than 2 and the temporal MVPcandidate derived based on the temporal neighboring block of the currentblock being available, and deriving an eighth affine MVP candidateincluding a zero motion vector as candidate motion vectors for the CPsbased on the number of available affine MVP candidates being less than2.
 4. The image decoding method of claim 1, wherein a candidate motionvector for the CP0 is available based on a reference picture of a firstblock in a first group being same as a reference picture of the currentblock, a candidate motion vector for the CP1 is available based on areference picture of a second block in a second group being same as areference picture of the current block, a candidate motion vector forthe CP2 is available based on a reference picture of a third block in athird group being same as a reference picture of the current block, andthe affine MVP candidate list includes the affine MVP candidate based onthe candidate motion vector for the CP0 being available, the candidatemotion vector for the CP1 being available, and the candidate motionvector for the CP2 being available.
 5. The image decoding method ofclaim 4, wherein the first group includes a neighboring block A, aneighboring block B and a neighboring block C, the second group includesa neighboring block D and a neighboring block E, the third groupincludes a neighboring block F and a neighboring block G, and whereinthe neighboring block A is a block including a sample at coordinates(−1, −1), the neighboring block B is a block including a sample atcoordinates (0, −1), the neighboring block C is a block including asample at coordinates (−1, 0), the neighboring block D is a blockincluding a sample at coordinates (W−1, −1), the neighboring block E isa block including a sample at coordinates (W, −1), the neighboring blockF is a block including a sample at coordinates (−1, H−1), and theneighboring block G is a block including a sample at coordinates (−1, H)based on a size of the current block being W×H, and an x component of atop-left sample position of the current block being 0 and a y componentthereof being
 0. 6. The image decoding method of claim 5, wherein thefirst block is a block which has been first confirmed while checkingneighboring blocks in the first group in a first predetermined order tobe that a reference picture thereof is the same as a reference pictureof the current block, the second block is a block which has been firstconfirmed while checking neighboring blocks in the second group in asecond predetermined order to be that a reference picture thereof is thesame as a reference picture of the current block, and the third block isa block which has been first confirmed while checking neighboring blocksin the third group in a third predetermined order to be that a referencepicture thereof is the same as a reference picture of the current block.7. The image decoding method of claim 6, wherein the first predeterminedorder is an order from the neighboring block A to the neighboring blockB, and then to the neighboring block C, the second predetermined orderis an order from the neighboring block D to the neighboring block E, andthe third predetermined order is an order from the neighboring block Fto the neighboring block G.
 8. An image encoding method, by an encodingapparatus, comprising: configuring an affine motion vector predictor(MVP) candidate list for a current block; deriving control point motionvector predictors (CPMVPs) for control points (CPs) of the current blockbased on the affine MVP candidate list; deriving control point motionvectors (CPMVs) for the CPs of the current block; deriving control pointmotion vector differences (CPMVDs) for CPs of the current block based onthe CPMVPs and the CPMVs; and encoding motion prediction informationincluding information on the CPMVDs, wherein the configuring of theaffine MVP candidate list comprises: checking whether a first affine MVPcandidate is available, wherein the first affine MVP candidate isavailable based on a first block in a left block group being coded withan affine motion model and a reference picture index of the first blockbeing same as a reference picture index of the current block; checkingwhether a second affine MVP candidate is available, wherein the secondaffine MVP candidate is available based on a second block in a top blockgroup being coded with an affine motion model and a reference pictureindex of the second block being same as a reference picture index of thecurrent block, wherein the left block group includes a bottom-leftcorner neighboring block of the current block, and a first leftneighboring block adjacent to an upper side of the bottom-left cornerneighboring block, and wherein the top block group includes a top-rightcorner neighboring block of the current block, a first top neighboringblock adjacent to a left side of the top-right corner neighboring block,and a top-left corner block; and checking whether a third affine MVPcandidate available based on a number of the available affine MVPcandidate is less than 2, wherein a 6-parameter affine model is used toan inter prediction, wherein for the 6-parameter affine model being usedto the inter prediction, the third MVP affine candidate is availablebased on the first motion vector for CP0, the second motion vector forthe CP1 and a third motion vector for CP2 of the current block beingderived from a top-left block group of the current block, a top-rightblock group of the current block and the left block group respectively,and wherein the top-left block group includes a top-left cornerneighboring block of the current block, a second left neighboring blockadjacent to a bottom side of the top-left corner neighboring block, anda second top neighboring block adjacent to a right side of the top-leftcorner neighboring block, and the top-right block group includes atop-right corner neighboring block and a top neighboring block.
 9. Theimage encoding method of claim 8, wherein the configuring of the affineMVP candidate list comprises; deriving a fourth affine MVP candidate toa sixth affine MVP candidate based on the number of available affine MVPcandidates being less than 2, wherein the fourth affine MVP candidate tothe sixth affine MVP candidate include an available first motion vectorfor the CP0, an available second motion vector for the CP1 and anavailable third motion vector for CP2 as candidate motion vectors forthe CPs.
 10. The image encoding method of claim 8, wherein a candidatemotion vector for the CP0 is available based on a reference picture of afirst block in a first group being same as a reference picture of thecurrent block, a candidate motion vector for the CP1 is available basedon a reference picture of a second block in a second group being same asa reference picture of the current block, a candidate motion vector forthe CP2 is available based on a reference picture of a third block in athird group being same as a reference picture of the current block, andthe affine MVP candidate list includes the affine MVP candidate based onthe candidate motion vector for the CP0 being available, the candidatemotion vector for the CP1 being available and the candidate motionvector for the CP2 being available.
 11. The image encoding method ofclaim 10, wherein the first block is a block which has been firstconfirmed while checking neighboring blocks in the first group in afirst predetermined order to be that a reference picture thereof is thesame as a reference picture of the current block, the second block is ablock which has been first confirmed while checking neighboring blocksin the second group in a second predetermined order to be that areference picture thereof is the same as a reference picture of thecurrent block, and the third block is a block which has been firstconfirmed while checking neighboring blocks in the third group in athird predetermined order to be that a reference picture thereof is thesame as a reference picture of the current block.
 12. A non-transitorycomputer readable storage medium storing a bitstream generated by amethod, the method comprising; configuring an affine motion vectorpredictor (MVP) candidate list for a current block; deriving controlpoint motion vector predictors (CPMVPs) for control points (CPs) of thecurrent block based on the affine MVP candidate list; deriving controlpoint motion vectors (CPMVs) for the CPs of the current block; derivingcontrol point motion vector differences (CPMVDs) for CPs of the currentblock based on the CPMVPs and the CPMVs; and encoding motion predictioninformation including information on the CPMVDs to generate thebitstream, wherein the configuring of the affine MVP candidate listcomprises: checking whether a first affine MVP candidate is available,wherein the first affine MVP candidate is available based on a firstblock in a left block group being coded with an affine motion model anda reference picture index of the first block being same as a referencepicture index of the current block; checking whether a second affine MVPcandidate is available, wherein the second affine MVP candidate isavailable based on a second block in a top block group being coded withan affine motion model and a reference picture index of the second blockbeing same as a reference picture index of the current block, whereinthe left block group includes a bottom-left corner neighboring block ofthe current block, and a first left neighboring block adjacent to anupper side of the bottom-left corner neighboring block, and wherein thetop block group includes a top-right corner neighboring block of thecurrent block, a first top neighboring block adjacent to a left side ofthe top-right corner neighboring block, and a top-left corner block; andchecking whether a third affine MVP candidate available based on anumber of the available affine MVP candidate is less than 2, wherein a6-parameter affine model is used to a inter prediction, wherein for the6-parameter affine model being used to the inter prediction, the thirdMVP affine candidate is available based on the first motion vector forCP0, the second motion vector for the CP1 and a third motion vector forCP2 of the current block being derived from a top-left block group ofthe current block, a top-right block group of the current block and theleft block group respectively, and wherein the top-left block groupincludes a top-left corner neighboring block of the current block, asecond left neighboring block adjacent to a bottom side of the top-leftcorner neighboring block, and a second top neighboring block adjacent toa right side of the top-left corner neighboring block, and the top-rightblock group includes a top-right corner neighboring block and a topneighboring block.
 13. A method of transmitting a bitstream generated bya method, the method comprising; configuring an affine motion vectorpredictor (MVP) candidate list for a current block; deriving controlpoint motion vector predictors (CPMVPs) for control points (CPs) of thecurrent block based on the affine MVP candidate list; deriving controlpoint motion vectors (CPMVs) for the CPs of the current block; derivingcontrol point motion vector differences (CPMVDs) for CPs of the currentblock based on the CPMVPs and the CPMVs; and encoding motion predictioninformation including information on the CPMVDs to generate thebitstream, wherein the configuring of the affine MVP candidate listcomprises: checking whether a first affine MVP candidate is available,wherein the first affine MVP candidate is available based on a firstblock in a left block group being coded with an affine motion model anda reference picture index of the first block being same as a referencepicture index of the current block; checking whether a second affine MVPcandidate is available, wherein the second affine MVP candidate isavailable based on a second block in a top block group being coded withan affine motion model and a reference picture index of the second blockbeing same as a reference picture index of the current block, whereinthe left block group includes a bottom-left corner neighboring block ofthe current block, and a first left neighboring block adjacent to anupper side of the bottom-left corner neighboring block, and wherein thetop block group includes a top-right corner neighboring block of thecurrent block, a first top neighboring block adjacent to a left side ofthe top-right corner neighboring block, and a top-left corner block; andchecking whether a third affine MVP candidate available based on anumber of the available affine MVP candidate is less than 2, wherein a6-parameter affine model is used to an inter prediction, wherein for the6-parameter affine model being used to the inter prediction, the thirdMVP affine candidate is available based on the first motion vector forCP0, the second motion vector for the CP1 and a third motion vector forCP2 of the current block being derived from a top-left block group ofthe current block, a top-right block group of the current block and theleft block group respectively, and wherein the top-left block groupincludes a top-left corner neighboring block of the current block, asecond left neighboring block adjacent to a bottom side of the top-leftcorner neighboring block, and a second top neighboring block adjacent toa right side of the top-left corner neighboring block, and the top-rightblock group includes a top-right corner neighboring block and a topneighboring block.